babel-plugin-magic-comments

1.0.7 • Public • Published

babel-plugin-magic-comments

CI codecov NPM version

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-comments

Next 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.

Package Sidebar

Install

npm i babel-plugin-magic-comments

Weekly Downloads

2

Version

1.0.7

License

MIT

Unpacked Size

9.41 kB

Total Files

6

Last publish

Collaborators

  • morganney