1.1.5 • Published 3 months ago

webpack-chunkname-loader v1.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

webpack-chunkname-loader

CI codecov

!WARNING Uses a regex to find dynamic import expressions, your mileage may vary. For parser support use magic-comments-loader.

Adds webpackChunkName magic coments to your dynamic import expressions.

If you need other magic comments or more configuration options use magic-comments-loader.

Usage

First npm install webpack-chunkname-loader.

Configuration

Add this inside your webpack.config.js:

module: {
  rules: [
    {
        test: /\.js$/,
        exclude: /node_modules/,
        use: ['webpack-chunkname-loader']
    }
  ]
}

You can supply an option to include webpackMode magic comments:

module: {
  rules: [
    {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'webpack-chunkname-loader',
          options: {
            webpackMode: 'eager'
          }
        }
    }
  ]
}

Magic Comments

With webpack-chunkname-loader added to your webpack build, the following dynamic import:

const dynamicModule = await import('./path/to/some/module')

becomes:

const dynamicModule = await import(/* webpackChunkName: "path-to-some-module" */ './path/to/some/module')
1.1.5

3 months ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago