Feature to document
NamedChunksPlugin
https://github.com/webpack/webpack/pull/4553
Author(s)
@timse
Additional information
Didn't find any info on https://webpack.js.org/plugins/ (left hand side menu)
It is recommended for long term caching (https://github.com/webpack/webpack/issues/1315#issuecomment-386267369) 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
I would like to second this issue. This really needs to be documented, especially since it is enabled by default with mode: 'development'. What exactly am I enabling?
@sokra can you please shed some light so we can kick off a PR ? I dont really have time this week to go through the sources sorry :( Maybe someone else has time to dig into and file a PR please shout.
This should help out a little bit https://github.com/webpack/webpack.js.org/blob/master/src/content/configuration/optimization.md#optimizationnamedmodules
Most helpful comment
I would like to second this issue. This really needs to be documented, especially since it is enabled by default with
mode: 'development'. What exactly am I enabling?https://webpack.js.org/concepts/mode/