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

feat(css): upgrade postcss-modules #10987

merged 1 commit into from
Nov 19, 2022


Copy link

@jquense jquense commented Nov 18, 2022


Upgrades the css-modules postcss plugin to the latest version. The upgrade is a major version but the change is not breaking in behavior (as far as I can tell) but an API change where this second argument is passed in to the resolve options. I passed the new importer argument to the vite resolvers, since that seems to be more correct HOWEVER, if we are very afraid of potential behavior changes i can ignore the option and fully ensure the change doesn't change anything

Beyond this option there are upgrades to the CSS module helpers that bring it's behavior up to date with other CSS module implementations (e.g. webpack's css-loader). Specifically Vite does not replace @value references in selectors when it should.

Additional context

I am trying to build a proper astroturf plugin which depends on the selector replacement of CSS modules

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bluwy bluwy changed the title feat: upgrade postcss-modules feat(css): upgrade postcss-modules Nov 19, 2022
@patak-dev patak-dev merged commit 892916d into vitejs:main Nov 19, 2022
@jquense jquense deleted the update-postcss-modules branch November 19, 2022 16:23
Copy link
Contributor Author

jquense commented Nov 19, 2022

many thanks 🙇

Copy link
Contributor Author

jquense commented Nov 23, 2022

any chance to backport to v3? I'm happy to do the work if so

fc pushed a commit to fc/vite that referenced this pull request Nov 23, 2022
Copy link

bluwy commented Nov 25, 2022

While we usually don't backport features back to v3, this does seem like a small change and fixes a bug, so maybe it's fine to backport this to the v3 branch. cc @patak-dev

bluwy pushed a commit that referenced this pull request Nov 29, 2022
patak-dev pushed a commit that referenced this pull request Nov 30, 2022
* fix(config): exclude config.assetsInclude empty array (#10941)

fixes #10926

* feat(css): upgrade postcss-modules (#10987)

* fix(mpa): support mpa fallback (#10985)

fixes #10966

* fix: export preprocessCSS in CJS (#11067)

* chore: update license

Co-authored-by: sun0day <>
Co-authored-by: Jason Quense <>
Co-authored-by: sun0day <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants