# dynamic imports require a leading comment with a webpackChunkName (dynamic-import-chunkname)
This rule reports any dynamic imports without a webpackChunkName specified in a leading block comment in the proper format.
This rule enforces naming of webpack chunks in dynamic imports. When you don't explicitly name chunks, webpack will autogenerate chunk names that are not consistent across builds, which prevents long-term browser caching.
## Rule Details
This rule runs against `import()` by default, but can be configured to also run against an alternative dynamic-import function, e.g. 'dynamicImport.'
You can also configure the regex format you'd like to accept for the webpackChunkName - for example, if we don't want the number 6 to show up in our chunk names:
```javascript
{
"dynamic-import-chunkname": [2, {
importFunctions: ["dynamicImport"],
webpackChunknameFormat: "[a-zA-Z0-57-9-/_]+"
}]
}
```
### invalid
The following patterns are invalid:
```javascript
// no leading comment
import('someModule');
// incorrectly formatted comment
import(
/*webpackChunkName:"someModule"*/
'someModule',
);
import(
/* webpackChunkName : "someModule" */
'someModule',
);
// chunkname contains a 6 (forbidden by rule config)