import/dynamic-import-chunkname
eslint-plugin-import
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/dynamic-import-chunkname": "error",
},
},
];Enforce a leading comment with the webpackChunkName for dynamic imports.
// incorrectly formatted comment
import(
/*webpackChunkName:"someModule"*/
'someModule',
);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',
);import('someModule');
import(
/* webpackChunkName: "someModule" */
'someModule',
);Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
import/dynamic-import-chunkname
eslint-plugin-import
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/dynamic-import-chunkname": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce which files can be imported in a given folder.
Forbid modules without exports, or exports without matching import in another module.
Forbid imported names marked with @deprecated documentation tag.
Enforce either using, or omitting, the node: protocol when importing Node.js builtin modules.
Forbid potentially ambiguous parse goal (script vs. module).