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
Right now documentation proposed the following way to intent the "right" order of styles
// with chunk format [chunkhash]_[id] lower ids are potentialy should be defined before higher
const styleData = discoverProjectStyles(resolve('build'), name => {
// get ID of a chunk and use it as order hint
const match = name.match(/(\d)_c.css/);
return match && +match[1];
});
which is generally not correct, even if working in the majority of the use cases.
The text was updated successfully, but these errors were encountered:
import{stylesheetCorrectOrder}from"webpack-imported/css";importconfigurationfrom'./build/imported.json';// <<---- generate file using WebpackImportedPlugin// get all css filesconstcssFiles=configuration.assets.filter((asset)=>asset.type==="css").map(({ name })=>name);// map to chunksconstcssToChunk=Object.entries(configuration.chunkMap).reduce((acc,[key,value])=>{if(value.css){value.css.forEach((css)=>{acc[css]=key;});}returnacc;},{}asRecord<string,string>);// "correct order", list all chunks in the prority webpack will list them// __ this line is the main deal breaker here __constorder=stylesheetCorrectOrder(configuration);// generate style dataconststyleData=discoverProjectStyles(process.env.PUBLIC_DIR!,(name)=>{constasset=cssFiles.find((clientAsset)=>name.includes(clientAsset));if(asset&&cssToChunk[asset]){returnorder.indexOf(cssToChunk[asset]);}returnfalse;});
Right now documentation proposed the following way to intent the "right" order of styles
which is generally not correct, even if working in the majority of the use cases.
The text was updated successfully, but these errors were encountered: