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]: css.experiments prefers-color-scheme at import not being applied #9142

Open
daveskybet opened this issue Jan 31, 2025 · 0 comments
Open
Assignees

Comments

@daveskybet
Copy link
Contributor

System Info

System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 87.59 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.9.0 - ~/.asdf/installs/nodejs/20.9.0/bin/node
npm: 10.1.0 - ~/.asdf/installs/nodejs/20.9.0/bin/npm
pnpm: 9.15.2 - ~/.asdf/installs/nodejs/20.9.0/bin/pnpm
Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 132.0.6834.160
Safari: 17.6
npmPackages:
@rspack/cli: ^1.2.2 => 1.2.2
@rspack/core: ^1.2.2 => 1.2.2

Details

On using the native css.experiments in Rspack, attempting to use the (prefers-color-scheme) syntax on css @import, the css file gets included at compilation without being wrapped in an @media query, causing the expected conditional not to be applied.

I'm not sure whether this is a bug or an expected unimplemented feature as per https://github.com/web-infra-dev/rspack/blob/cc5e3f6a49073b354c08ec4b8c75142e602d02ee/crates/rspack_plugin_css/webpack_css_cases_to_be_migrated/at-import-layer/style.css

Can you advise? Out of a large application i have one instance of this syntax causing me to revert to css-loader over handling everything in Rspack, bumping up the build time significantly.

Reproduce link

https://github.com/daveskybet/repro-import-prefers-color-scheme

Reproduce Steps

  1. @import a css file using the (prefers-color-scheme) syntax
  2. On compilation see that the css file has been included without being wrapped in a @media query
@daveskybet daveskybet added the pending triage The issue/PR is currently untouched. label Jan 31, 2025
@chenjiahan chenjiahan removed the pending triage The issue/PR is currently untouched. label Feb 6, 2025
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

3 participants