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

from id is always cleaned before being passed to the PostCSS plugins #7822

Closed
7 tasks done
MadLittleMods opened this issue Apr 20, 2022 · 1 comment · Fixed by #7827
Closed
7 tasks done

from id is always cleaned before being passed to the PostCSS plugins #7822

MadLittleMods opened this issue Apr 20, 2022 · 1 comment · Fixed by #7827

Comments

@MadLittleMods
Copy link
Contributor

MadLittleMods commented Apr 20, 2022

Describe the bug

Nowadays with [email protected]+, we always use cleanUrl(id) which removes extra query parameter information potentially added in the Vite/rollup build steps when we pass the file off to the PostCSS plugins. This behavior was changed in #7173 (specifically).

Before (id) After (cleanUrl(id))
/Users/eric/Documents/github/element/hydrogen-web/src/platform/web/ui/css/themes/element/theme.css?variant=dark&dark=true /Users/eric/Documents/github/element/hydrogen-web/src/platform/web/ui/css/themes/element/theme.css

Before [email protected], we would directly pass the id to the PostCSS from field which plugins can access via root.source.input.from. This old behavior was used in one of our custom PostCSS plugins to filter out certain files based on those ?variant=dark&dark=true query parameters.

I'm wondering if this was a totally intentional change and we need to refactor our PostCSS plugin to work around this? Or if Vite should be adjusted to accommodate again?


Spawned from element-hq/hydrogen-web#722

Reproduction

https://stackblitz.com/edit/vitejs-vite-bswz32?file=my-postcss-plugin.js&terminal=dev

System Info

npx envinfo --system --npmPackages '{vite,@vitejs/*}' --binaries --browsers

  System:
    OS: Windows 10 10.0.19044
  Binaries:
    Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.18 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD

Used Package Manager

yarn

Logs

No response

Validations

@MadLittleMods
Copy link
Contributor Author

Thanks for the quick fix @sapphi-red #7827 🎉

MadLittleMods added a commit to element-hq/hydrogen-web that referenced this issue May 5, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants