# dynamic-import-chunkname

Rule `import/dynamic-import-chunkname`. Enforce a leading comment with the webpackChunkName for dynamic imports.

- Source: import
- Technologies: Imports
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1887 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `import/dynamic-import-chunkname` | no | suggestion | package `eslint-plugin-import` | [docs](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/docs/rules/dynamic-import-chunkname.md) |

## Code examples

### Incorrect: the rule reports this

```js
// incorrectly formatted comment
import(
  /*webpackChunkName:"someModule"*/
  'someModule',
);
```

### Correct: the rule accepts this

```js
import(
  /* webpackChunkName: "someModule" */
  'someModule',
);
import(
  /* webpackChunkName: "someOtherModule12345789" */
  'someModule',
);
import(
  /* webpackChunkName: "someModule" */
  /* webpackPrefetch: true */
  'someModule',
);
import(
  /* webpackChunkName: "someModule", webpackPrefetch: true */
  'someModule',
);

// using single quotes instead of double quotes
import(
  /* webpackChunkName: 'someModule' */
  'someModule',
);
```

```js
import('someModule');

import(
  /* webpackChunkName: "someModule" */
  'someModule',
);
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import importPlugin from "eslint-plugin-import";

export default [
  {
    plugins: { import: importPlugin },
    rules: {
      "import/dynamic-import-chunkname": "error",
    },
  },
];
```

## Related rules

- [import/no-internal-modules](https://lintradar.dev/rules/import/no-internal-modules.md): Forbid importing the submodules of other modules.
- [import/no-restricted-paths](https://lintradar.dev/rules/import/no-restricted-paths.md): Enforce which files can be imported in a given folder.
- [import/no-unused-modules](https://lintradar.dev/rules/import/no-unused-modules.md): Forbid modules without exports, or exports without matching import in another module.
- [import/no-deprecated](https://lintradar.dev/rules/import/no-deprecated.md): Forbid imported names marked with `@deprecated` documentation tag.
- [import/enforce-node-protocol-usage](https://lintradar.dev/rules/import/enforce-node-protocol-usage.md): Enforce either using, or omitting, the `node:` protocol when importing Node.js builtin modules.
- [import/unambiguous](https://lintradar.dev/rules/import/unambiguous.md): Forbid potentially ambiguous parse goal (`script` vs. `module`).

---

Web page: https://lintradar.dev/rules/import/dynamic-import-chunkname. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
