Socket
Book a DemoInstallSign in
Socket

babel-plugin-magic-comments

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-magic-comments

Adds webpack magic comments to your dynamic imports.

1.0.7
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

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.

Keywords

babel

FAQs

Package last updated on 19 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.