Skip to content

Is it possible to expose the place where stylePostLoader is inserted as a configuration item? #2091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1714080902120 opened this issue Apr 21, 2025 · 0 comments

Comments

@1714080902120
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant