babel-plugin-magic-comments
v1.0.7
Published
Adds webpack magic comments to your dynamic imports.
Maintainers
Readme
babel-plugin-magic-comments
Babel plugin to add webpack magic comments to your dynamic import() expressions at build time.
Getting Started
First install babel-plugin-magic-comments:
npm install babel-plugin-magic-commentsNext add the plugin to your babel.config.js:
export default () => {
return {
plugins: [
['magic-comments', {
verbose: true,
webpackChunkName: true,
webpackFetchPriority: "high"
}]
]
}
}Or include it directly in your webpack.config.js:
module: {
rules: [
{
test: /\.[jt]sx?$/,
use: {
loader: 'babel-loader',
options: {
plugins: [
['magic-comments', {
verbose: true,
webpackChunkName: true,
webpackFetchPriority: "high"
}]
]
}
}
}
]
}Options
The options are the same as those used by magic-comments-loader, with the exception of mode (not supported).
Examples
For some more usage examples you can check out the ones provided by magic-comments-loader, particularly the loader's options.
