webpack4 splitChunks: 'all' support
wangzuo opened this issue · 16 comments
For the following config in webpack4,
optimization: {
splitChunks: {
chunks: 'all'
},
runtimeChunk: true
}
In the webpack output stats, there is a list of files needed for each entrypoint like
Entrypoint about = runtime~about-b126ba8d5183247aa513.js vendors~about~home-bf6fa999743882049ea0.js about-f2320ebef52984b8b8a2.js
Entrypoint home = runtime~home-6b634e8923dcf64c8687.js vendors~about~home-bf6fa999743882049ea0.js static/css/home.3a775e54.chunk.css home-3a775e546f2420ba6807.js static/css/home.3a775e54.chunk.css.map
I am wondering is there any way to support this format in manifest plugin output?
Can you give us the actual and expected manifest?
I would think we support that, if not then that's an issue
I would expect a manifest file with entrypoint support like
"about.js": ["/packs/runtime~about-b126ba8d5183247aa513.js", "/packs/vendors~about~home-bf6fa999743882049ea0.js", "/packs/about-f2320ebef52984b8b8a2.js"],
instead of
{
"runtime~about.js": "/packs/runtime~about-b126ba8d5183247aa513.js",
"vendors~about~home.js": "/packs/vendors~about~home-bf6fa999743882049ea0.js",
"about.js": "/packs/about-f2320ebef52984b8b8a2.js"
}
Oh, I see. I'm afraid it's the correct behaviour
Did you try using https://github.com/danethurber/webpack-manifest-plugin#hooks-options ?
Thanks, guess thats what i want
Let me know if you think a new options should be added to make that job easier
I dont think its possible with current implementation, the entrypoints available in new compilation.chunkGroups
. The following is my implementation to add an extra entrypoints
field in the manifest file, wondering someone find a better way for this feature.
manifest.entrypoints = compilation.chunkGroups.reduce((result, group) => {
const files = new Set();
group.chunks.forEach(chunk => {
chunk.files.forEach(file => {
files.add(`${chunk.name}${extname(file)}`);
});
});
result[group.name] = Array.from(files);
return result;
}, {});
I will try to have a look when I have time, a failing test would help a lot
@bf webpack-assets-manifest works
Thank you. In the meantime I have adapted WebpackSplittingManifestPlugin
to work with webpack 4 and our specific AggressiveSplittingPlugin
use case.
Is there any update on this issue? I think this plugin should support entrypoints
like webpack-assets-manifest
.
please fix
@wangzuo Why have you closed this issue?
@mastilver I think this remains a valid issue to be fixed/implemented. Would you re-open it?
Is the solution here simply to use https://github.com/webdeveric/webpack-assets-manifest, or is there any update?