Is it possible to expose the place where stylePostLoader is inserted as a configuration item?
Opened this issue · 0 comments
1714080902120 commented
LightningCSS can't handle some special cases currently. So i want to move the lightningcss-loader after stylePostLoader:
// vue-loader pitcher.js
if (cssLoaderIndex > -1) {
// if inlined, ignore any loaders after css-loader and replace w/ inline
// loader
const lightningcssLoaderIndex = loaders.findIndex((loader) => {
return /builtin:lightningcss-loader/.test(loader.path);
});
const injectLoaders = lightningcssLoaderIndex > -1 ? [...loaders.splice(lightningcssLoaderIndex, lightningcssLoaderIndex + 1)] : [];
const afterLoaders = query.inline != null
? [styleInlineLoaderPath]
: loaders.slice(0, cssLoaderIndex + 1);
const beforeLoaders = loaders.slice(cssLoaderIndex + 1);
injectLoaders.push(stylePostLoaderPath);
return genProxyModule([...afterLoaders, ...injectLoaders, ...beforeLoaders], context, !!query.module || query.inline != null, query.lang || 'css');
}I've tried to adjust the order with the loader, but the stylePostLoader will be triggered repeatedly after lightningcss-loader, causing the style to be abnormal.
I also want to use normalModuleFactory.hooks.beforeLoaders to adjust the loader order, but rspack doesn't expose this hooks.
Or is there another way to bypass this issue?