Source Map
Farm supports Source Map
, which is automatically enabled by default. Sourcemap can be enable
or disable
via the compilation.sourcemap
option.
Farm will not generate sourcemap for files under node_modules
by default, if you want to generate sourcemap for files under node_modules, configure compilation.sourcemap
to all
.
Using compilation.sourcemap
to configuring sourcemap generation:
export default {
compilation: {
sourcemap: 'all', // generate sourcemap for modules under node_modules
},
};
All options are as below:
true
: Only generate sourcemap for files not undernode_modules
, and generate a separate sourcemap filefalse
: disable sourcemapinline
: Only generate sourcemap for files not undernode_modules
, and inline sourcemap into the product, do not generate a separate fileall
: generate sourcemap for all files, and generate a separate sourcemap fileall-inline
: Generate source maps for all files, and inline source maps into the product, do not generate separate files
For plugin authors, if you transform the code in transform hook
or renderResourcePot hook
, you should return the source map of your transformation to ensure source map is correct. Farm maintains a source map chain of plugins to trace the final resources back to the real original code.