Package Exports
- adjust-sourcemap-loader
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (adjust-sourcemap-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Adjust Source-map Loader
Webpack loader that adjusts source maps.
Usage
require('adjust-sourcemap?format=absolute!babel?sourceMap');Source maps required
Note that source maps must be enabled on any preceding loader. In the above example we use babel?sourceMap.
Apply via webpack config
It is preferable to adjust your webpack.config so to avoid having to prefix every require() statement:
module.exports = {
module: {
loaders: [
{
test : /\.js/,
loaders: ['adjust-sourcemap?format=absolute', 'babel?sourceMap']
}
]
}
};Options
Options may be set using query parameters or by using programmatic parameters. Programmatic means the following in your webpack.config.
module.exports = {
adjustSourcemapLoader: {
...
}
}Where ... is a hash of any of the following options.
debug:boolean|RegExpMay be used alone (boolean) or with aRegExpto match the resource(s) you are interested in debugging.format:stringOptional output format for source-mapsources. Must be the camel-case name of one of the availablecodecs. Omitting the format will result in no changes to the source-map.root:booleanA boolean flag that indices that asourceRootpath sould be included in the output map. This is contingent on aformatbeing specified.codecs:Array.<{name:string, decode:function, encode:function, root:function}>Optional Array of codecs. There are a number of built-in codecs available.
Note that query parameters take precedence over programmatic parameters.
Built-in codecs that may be specified as a format include absolute, bowerComponent, outputRelative, projectRelative, sourceRelative, webpackProtocol.
How it works
The loader will receive a source map as the second parameter where the preceding loader created one.
The exception is the css-loader where the source-map is in the content, which is not currently supported.
The source-map sources are parsed by applying codec.decode() functions until one of them returns an absolute path to a file that exists.
If a format is specified then the source-map sources are recreated by applying the codec.encode() function for the stated format.
So long as a format is specified, the root option implies that the codec.root() function is set the source-map sourceRoot. Otherwise sourceRoot is omitted from the new source-map.
