-
-
Notifications
You must be signed in to change notification settings - Fork 609
Closed
Description
Bug report
When using @import
that is not the first statement (besides @charset
or empty @layer
), it should be ignored.
.foo {
color: red;
}
@import "./bar.css"; /** <-- Should be ignored */
Actual Behavior
The bar.css
would be bundled by Webpack / Rspack.
This is because css-loader
generates an import to bar.css
Expected Behavior
The bar.css
should be ignored. Just like Browsers, postcss-import
and lightningcss
does.
How Do We Reproduce?
- Clone https://github.com/colinaaa-reproductions/css-loader-repro-invalid-at-import
- Run
pnpm install
- Run
pnpm run build
to see build results of Webpack / Rspack / Rsbuild / PostCSS - Run
npx http-server
to see the behavior of the browser
Please paste the results of npx webpack-cli info
here, and mention other relevant information.
System:
OS: Linux 5.15 veLinux GNU/Linux 2 (lyra) 2 (lyra)
CPU: (64) x64 Intel(R) Xeon(R) Platinum 8457C
Memory: 245.78 GB / 251.61 GB
Binaries:
Node: 24.6.0 - /run/user/1001/fnm_multishells/1085744_1758014209177/bin/node
npm: 11.5.1 - /run/user/1001/fnm_multishells/1085744_1758014209177/bin/npm
pnpm: 10.15.1 - /run/user/1001/fnm_multishells/1085744_1758014209177/bin/pnpm
Packages:
css-loader: ^7.1.2 => 7.1.2
html-webpack-plugin: ^5.6.4 => 5.6.4
webpack: ^5.101.3 => 5.101.3
webpack-cli: ^6.0.1 => 6.0.1
Metadata
Metadata
Assignees
Labels
No labels