Adds support for sourcemaps to a node app in a hacky fashion.
The plugin shamefully depends on adding a module to your project directory. A require statement is inserted into your entry files to require the source-map-support module.
It can be argued that it is a better idea to install source-map-support
into your project and require it yourself.
npm install babel-plugin-node-sourcemap-support
.babelrc
{
"plugins": [
["node-sourcemap-support", {
"src": "./path/to/src",
"dest": "./path/to/out/dir",
"entries": [
"app.js",
"foo/bar.js"
]
}]
]
}
babel --source-maps inline ./path/to/src --out-dir ./path/to/out/dir
path to source files directory
path to transpiled files directory
array of app entry file paths, relative to src
path where the module will be added, relative to dest
You probably should not turn this off. It prevents the support module from being redundantly copied to dest
every time babel transpiles a file.