You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an error in the documentation, we will fix it.
You can achieve the desired effect using the example below:
constwebpackVersion=require("webpack").version;functionrecursiveIssuer(m){if(m.issuer){returnrecursiveIssuer(m.issuer);}constchunks=webpackVersion==="4" ? m._chunks : m.getChunks();for(constchunkofchunks){returnchunk["name"];}returnfalse;}module.exports={entry: {app1: path.resolve(__dirname,"..","src","app1.js"),app2: path.resolve(__dirname,"..","src","app2.js"),},
...
optimization: {splitChunks: {cacheGroups: {app1Styles: {// For webpack 4 name should not be equal entry. We recommend upgrading to webpack@5name: "style_app",test: (m,c,entry="app1")=>m.constructor.name==="CssModule"&&recursiveIssuer(m)===entry,chunks: "all",enforce: true,},},},},};
Expected Behavior
Extracting CSS based on entry example should work.
In the reproduce repo,
CSS of
comp1.css
should merge intoapp1.css
.CSS of
comp2.css
should merge intoapp2.css
.Actual Behavior
Each of
comp1
&comp2
has its own CSS chunk.And:
How Do We Reproduce?
Here is the reproduce repo
https://github.com/pinkiebala/extract-css-entry-failed-reproduce
The text was updated successfully, but these errors were encountered: