[Remix/Vite] Vanilla generated css files doesn't get injected into html after build
Describe the bug
Vanilla css styles do get injected into html in dev mode, but in production they don't get injected. They do generate in the build/client/assets directory but are not 'used'.
I use bun as package manager
NOTE: To have exactly my setup use my flake.nix with the nix package manager. not a must at all but its nice.
Head tag in devmode
<head>
...
<style>
/* /app/root.css.ts.vanilla.css */
body {
background-color: red;
}
<link .... />
<link .... />
<link .... />
</head>
Head tag in prod
<head>
....
<!-- No vanilla css files here -->
<link .... />
<link .... />
<link .... />
</head>
Reproduction
https://github.com/vincent-thomas/remix-vanilla-extract-css-repro
System Info
System:
OS: Linux 6.6 NixOS 24.11 (Vicuna) 24.11 (Vicuna)
CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
Memory: 22.59 GB / 31.25 GB
Container: Yes
Shell: 5.9 - /run/current-system/sw/bin/zsh
Binaries:
Node: 22.8.0 - /nix/store/xsrv93rg8vi05k9ig6v9mcvcyn01n6n2-nodejs-22.8.0/bin/node
npm: 10.8.2 - /nix/store/xsrv93rg8vi05k9ig6v9mcvcyn01n6n2-nodejs-22.8.0/bin/npm
bun: 1.1.29 - /nix/store/mqzlk40bnhx54by2m4lyyc02syippzad-bun-1.1.29/bin/bun
Used Package Manager
npm
Logs
No response
Validations
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Thanks for raising an issue. I've reproduced it locally and can confirm that the styles are missing. Specifically, it seem like remix is the side-effect import of the VE file, but it doesn't strip the tailwind one. If I export a style and use it within the app, all styles are present in a stylesheet.
I tested this out in a plain vite app and it is not an issue there, so it's specific to remix.
Okay i'll open an issue on remix instead
@vincent-thomas Sorry if my response sounded dismissive. I'm happy to keep this issue open at least to provide visibility on the VE side, but an issue in Remix would certainly be useful as well.
No problem, i totally understand that issues need to be closed and developer time should be focused on real vanilla extract bugs. Maybe this issue could be referenced under this page (https://vanilla-extract.style/documentation/integrations/remix)?
NOTE: I can open a pull request regarding this.
Btw I really like this library, an issue has been opened remix.
Tracked in remix https://github.com/remix-run/remix/issues/10045
Closing since the upstream has been closed as not planned.