Skip to content
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

[Bug]: The builtin loaders should not pass meta to the next loader #7819

Closed
chenjiahan opened this issue Sep 6, 2024 · 1 comment · Fixed by #7846
Closed

[Bug]: The builtin loaders should not pass meta to the next loader #7819

chenjiahan opened this issue Sep 6, 2024 · 1 comment · Fixed by #7846
Labels
bug Something isn't working team The issue/pr is created by the member of Rspack.

Comments

@chenjiahan
Copy link
Member

chenjiahan commented Sep 6, 2024

System Info

Rspack 1.0.3

Details

In webpack, the meta param of loader can only be passed to the next loader, and the bulitin loaders in Rspack should follow the same behavior.

https://webpack.js.org/api/loaders/#thiscallback

Example

For example, the css-loader and postcss-loader uses meta.ast to resue PostCSS AST, see:

When using Rspack's builtin:lightningcss-loader like this:

postcss-loader ---passing AST meta---> builtin:lightningcss-loader ---passing AST meta---> css-loader

The builtin:lightningcss-loader will not take any effect, because css-loader will read the AST meta from postcss-loader, and drop the transformation result of builtin:lightningcss-loader.

Reproduce link

web-infra-dev/rsbuild#3247

Reproduce Steps

See web-infra-dev/rsbuild#3247 for more details.

@chenjiahan chenjiahan added bug Something isn't working pending triage The issue/PR is currently untouched. labels Sep 6, 2024
@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Sep 6, 2024
@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Sep 6, 2024

This is probably caused by the logic of the Rust loader implementations. On rust side, we does not expose an API to override the values at once (content, sourceMap, additionalData). In this case, it caused the additionalData being accidentally passed onto the next loader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants