remix
remix copied to clipboard
Vanilla css not injecting the link tags in remix
Reproduction
https://github.com/vincent-thomas/remix-vanilla-extract-css-repro
run in dev mode: "bun run dev"
then run in prod mode "bun run build && bun run start"
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: 23.62 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
npmPackages:
@remix-run/dev: ^2.12.1 => 2.12.1
@remix-run/node: ^2.12.1 => 2.12.1
@remix-run/react: ^2.12.1 => 2.12.1
@remix-run/serve: ^2.12.1 => 2.12.1
vite: ^5.1.0 => 5.4.8
Used Package Manager
bun
Expected Behavior
For the vanilla css styles corresponding link tag to be generated into the html in prod mode
Actual Behavior
This is not the case. Vanilla extract generates the css files, but does not inject the link tags in the html files. This has been tested on other vite projects and remix is the only one to fail
As mentioned in https://github.com/vanilla-extract-css/vanilla-extract/issues/1479, the issue seems to be that remix is stripping side-effect imports for some reason. Regular imports of Vanilla Extract styles are unaffected.
As mentioned in vanilla-extract-css/vanilla-extract#1479, the issue seems to be that remix is stripping side-effect imports for some reason. Regular imports of Vanilla Extract styles are unaffected.
Yes, and i should add that the package manager should not be relevant for this issue.
I think my project is also experiencing this issue. On initial loads the styling for the current page is loaded correctly. When using Remix Links to load another page, the styling is downloaded but not injected. This issue only exists during production build/runs but not during development using 'virtual:remix/server-build'.
[edit] For more context, the uses https://remix.run/docs/en/main/guides/vite#migrating-a-custom-server
Same issue for me.
It's a bit sad because Vanilla-Extract is presented in the Remix documentation.
It's a bit sad because Vanilla-Extract is presented in the Remix documentation.
Yes i agree. And i really like the api of vanilla-extract so it's a bit sad
@vincent-thomas FYI the react-router v7 vite plugin works fine with Vanilla Extract. I understand that migrating to react-router v7 requires a bit of effort, but it is an option.
Thank you for opening this issue, and our apologies we haven't gotten around to it yet!
With the release of React Router v7 we are sun-setting continued development/maintenance on Remix v2. If you have not already upgraded to React Router v7, we recommend you do so. We've tried to make the upgrade process as smooth as possible with our Future Flags. We are now in the process of cleaning up outdated issues and pull requests to improve the overall hygiene of our repositories.
We plan to continue to address 2 types of issues in Remix v2:
- Bugs that pose security concerns
- Bugs that prevent upgrading to React Router v7
If you believe this issue meets one of those criteria, please respond or create a new issue.
For all other issues, ongoing maintenance will be happening in React Router v7, so:
- If this is a bug, please reopen this issue in that repo with a new minimal reproduction against v7
- If this is a feature request, please open a new Proposal Discussion in React Router, and if it gets enough community support it can be considered for implementation
If you have any questions you can always reach out on Discord. Thanks again for providing feedback and helping us make our framework even better!