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/modules] class is disappear when composes is chained #7737

Closed
Thiry1 opened this issue Aug 2, 2023 · 1 comment · Fixed by #7917
Closed

[css/modules] class is disappear when composes is chained #7737

Thiry1 opened this issue Aug 2, 2023 · 1 comment · Fixed by #7917
Labels
Milestone

Comments

@Thiry1
Copy link
Contributor

Thiry1 commented Aug 2, 2023

Describe the bug

The css module specification allows composes to be chained.
https://github.com/css-modules/css-modules#:~:text=When%20a%20class%20name%20composes%20another%20class%20name%2C%20the%20CSS%20Module%20exports%20both%20class%20names%20for%20the%20local%20class.
So when compile the following css, root-class should have child-class and child-class2.
However, swc_css_modules does not.

Input code

.child-class2 {
  color: red;
}

.child-class {
  composes: child-class2;
}

.root-class {
  composes: child-class;
}

Config

none

Playground link

No response

Expected behavior

{
  "child-class": [
    {
      "type": "local",
      "name": "__local__child-class"
    },
    {
      "type": "local",
      "name": "__local__child-class2"
    }
  ],
  "child-class2": [
    {
      "type": "local",
      "name": "__local__child-class2"
    }
  ],
  "root-class": [
    {
      "type": "local",
      "name": "__local__root-class"
    },
    {
      "type": "local",
      "name": "__local__child-class"
    },
+   {
+     "type": "local",
+     "name": "__local__child-class2"
+   }
  ]
}

Actual behavior

d862121#diff-68c61c9e7905dcfc96fa4311d833c7da36303e22077b15074018b0f9c132606c

{
  "child-class": [
    {
      "type": "local",
      "name": "__local__child-class"
    },
    {
      "type": "local",
      "name": "__local__child-class2"
    }
  ],
  "child-class2": [
    {
      "type": "local",
      "name": "__local__child-class2"
    }
  ],
  "root-class": [
    {
      "type": "local",
      "name": "__local__root-class"
    },
    {
      "type": "local",
      "name": "__local__child-class"
    }
  ]
}

Version

1.3.73

Additional context

Transferred from web-infra-dev/rspack#3875

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 7, 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 Oct 7, 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