Skip to content

fix: resolve duplicate theme variables in CSS modules#97

Open
colinaaa wants to merge 2 commits intov4from
fix/css-modules-dedup
Open

fix: resolve duplicate theme variables in CSS modules#97
colinaaa wants to merge 2 commits intov4from
fix/css-modules-dedup

Conversation

@colinaaa
Copy link
Copy Markdown
Collaborator

Summary

  • Use @reference instead of @import for theme variables to resolve CSS modules duplication issues.
  • Add test cases for CSS modules dedup.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9a4b80a77

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

src/postcss.ts Outdated
root.prepend(
new AtRule({
name: 'import',
name: 'reference',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve theme import for CSS-only pipelines

Replacing the injected at-rule with @reference stops the theme stylesheet from emitting any CSS in PostCSS-processed files, which is a regression for builds that don’t go through the JS/TS virtual-utilities path. In this repo, the fallback real theme import is in createCompiler (src/compiler.ts) but that compiler is only reached via the JS/TS transform hook (api.transform in src/index.ts), so CSS-only entries (or plain CSS rules provided through the theme import chain) can lose their :root variables/rules entirely after this change.

Useful? React with 👍 / 👎.

… fix css modules dedup without breaking global css
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

Successfully merging this pull request may close these issues.

1 participant