Open
Description
Feature to document
NamedChunksPlugin
webpack/webpack#4553
Author(s)
Additional information
Didn't find any info on https://webpack.js.org/plugins/ (left hand side menu)
- What problems does it solve?
- Is it recommended? Deprecated?
It is recommended for long term caching (webpack/webpack#1315 (comment)) but it's not documented on the webpack website what the plugin does exactly and how (there's no info about its existence even ;))
new webpack.NamedChunksPlugin(chunk => {
if (chunk.name) {
return chunk.name;
}
// eslint-disable-next-line no-underscore-dangle
return [...chunk._modules]
.map(m =>
path.relative(
m.context,
m.userRequest.substring(0, m.userRequest.lastIndexOf("."))
)
)
.join("_");
}),
From quick check, AFAIU the goal is to have deterministic production code generated when using code splitting, like
__webpack_require__.e("my-async-chunk-name").then(... // will stay the same
instead of
__webpack_require__.e(7).then(... // this might change over time if new chunks are created