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

CSS module :global function syntax #8179

Closed
JSerFeng opened this issue Oct 25, 2023 · 8 comments · Fixed by #8219
Closed

CSS module :global function syntax #8179

JSerFeng opened this issue Oct 25, 2023 · 8 comments · Fixed by #8219
Assignees
Labels
Milestone

Comments

@JSerFeng
Copy link
Contributor

JSerFeng commented Oct 25, 2023

Describe the bug

Currently SWC css module pass cannot handle cases like this

.a:global(.b .c).d {
  color: red
}

SWC ignores .d

I tried fix this, but current algorithm seems hard to implement

lightningcss demo

Input code

No response

Config

No response

Playground link (or link to the minimal reproduction)

None

SWC Info output

No response

Expected behavior

.d should be renamed

Actual behavior

.d stay as is

Version

1.3.95

Additional context

No response

@JSerFeng JSerFeng added the C-bug label Oct 25, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 25, 2023
@swc-project swc-project deleted a comment from github-actions bot Oct 25, 2023
@kdy1 kdy1 reopened this Oct 25, 2023
@swc-project swc-project unlocked this conversation Oct 25, 2023
@kdy1
Copy link
Member

kdy1 commented Oct 25, 2023

We need more domains in allowlist 🤣

@kdy1 kdy1 removed the invalid link label Oct 25, 2023
@JSerFeng
Copy link
Contributor Author

Sry, I'll try to make a repro repo

@kdy1
Copy link
Member

kdy1 commented Oct 25, 2023

You don't need to

@kdy1
Copy link
Member

kdy1 commented Oct 25, 2023

It's just issue manager bot configured wrongly

@JSerFeng
Copy link
Contributor Author

I believe the cause is here, continue without handle other sub_class_selectors, but I failed to fix it 🥹

@kdy1 kdy1 added this to the Planned milestone Oct 25, 2023
@kdy1 kdy1 self-assigned this Oct 25, 2023
@kdy1
Copy link
Member

kdy1 commented Nov 4, 2023

Investigation

The current output is

.__local__a.b.d .c {
  color: red;
}

@JSerFeng
Copy link
Contributor Author

JSerFeng commented Nov 4, 2023

Thanks for reply, here is the result of css-loader, which I believe using postcss under the hood, and lots of users use css module this way.

image

image

@swc-bot
Copy link
Collaborator

swc-bot commented Dec 21, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants