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

[VITE] Libraries shipping vanilla extract css loaded out of order when using vite #1376

Open
2 tasks done
otaviosoares opened this issue Apr 5, 2024 · 1 comment
Open
2 tasks done

Comments

@otaviosoares
Copy link

Describe the bug

It happens when using vite and importing VE css from a library. The css is loaded in a non deterministic way, causing reset css to have a higher priority.

I created a small example using braid-design-system. Apparently, vite's dependency optimizer is bundling the styles in the wrong order, but I'm not sure.

Screenshot 2024-04-05 at 10 59 25 AM

Screenshot 2024-04-05 at 10 59 37 AM

DISCLAIMER: This only happens in dev mode. During build the css file that is extract has the correct order.

WORKAROUND I'm using css layers to avoid this issue but I'm intrigued and would love to know what's causing this behaviour. Any help is appreciated.

Reproduction

https://stackblitz.com/edit/vitejs-vite-qfbgzz

System Info

System:
    OS: macOS 14.2.1
    CPU: (16) arm64 Apple M3 Max
    Memory: 3.28 GB / 128.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 4.0.2 - ~/.yarn/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    bun: 1.0.0 - ~/.bun/bin/bun
  Browsers:
    Chrome: 123.0.6312.107
    Edge: 123.0.2420.81
    Safari: 17.2.1
  npmPackages:
    vite: ^5.1.4 => 5.1.4

Used Package Manager

yarn

Logs

No response

Validations

@rururux
Copy link

rururux commented May 8, 2024

maybe a duplicate of #725

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants