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

Order of CSS selectors is inconsistent each time the same build is run with Vite #10378

Closed
joelvh opened this issue Jan 21, 2023 · 3 comments · Fixed by #10382
Closed

Order of CSS selectors is inconsistent each time the same build is run with Vite #10378

joelvh opened this issue Jan 21, 2023 · 3 comments · Fixed by #10382

Comments

@joelvh
Copy link

joelvh commented Jan 21, 2023

What version of Tailwind CSS are you using?

tailwindcss v3.2.4

What build tool (or framework if it abstracts the build tool) are you using?

vite v4.0.3

What version of Node.js are you using?

node v16.18.1

What browser are you using?

Chrome

What operating system are you using?

macOs

Reproduction URL

CSS from server 1: https://play.tailwindcss.com/FhK4daTQLG?file=css
CSS from server 2: https://play.tailwindcss.com/eWyyqC64HS?file=css

Config file: https://play.tailwindcss.com/7WmGQKPdBk?file=config

Describe your issue

Tailwind is outputting CSS with selectors in a different order each time a build runs. This is prevalent when deploying to multiple servers. The same release will result in differing CSS build artifacts.

We experience this from time to time with a 404 error in the browser because the CSS filename on each server has a different hash. The HTML page is served from one server and then the CSS file is served by another server where the filename doesn't match.

I've provided a copy of the output of two servers where you can see the order in which CSS selectors is different. Config is also provided.

I want to say that this started with the move to Vite from Webpack.

Has anyone else experienced this?

image

@adamwathan
Copy link
Member

Hey! Pushed a tweak that should fix this for you here: #10382

Will be in the next release but you can try it now by installing our insiders build:

npm install -D tailwindcss@insiders

@joelvh
Copy link
Author

joelvh commented Jan 22, 2023

@adamwathan thanks for such a quick response! Much appreciated. Will give this a spin.

@terryupton
Copy link

@adamwathan - I can confirm this fix also works.
I was having an issue with the order for grid cols breakpoint order is wrong. sm: is overwriting lg: and xl: when using Vite 4 to build.

Screenshot 2023-02-02 at 10 58 52

Screenshot 2023-02-02 at 10 58 56

When do you intend to release this fix?

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 a pull request may close this issue.

3 participants