remix icon indicating copy to clipboard operation
remix copied to clipboard

Vanilla css not injecting the link tags in remix

Open vincent-thomas opened this issue 1 year ago • 2 comments

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

vincent-thomas avatar Oct 01 '24 19:10 vincent-thomas

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.

askoufis avatar Oct 03 '24 13:10 askoufis

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.

vincent-thomas avatar Oct 03 '24 18:10 vincent-thomas

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

francismanansala avatar Nov 04 '24 15:11 francismanansala

Same issue for me.

It's a bit sad because Vanilla-Extract is presented in the Remix documentation.

kube avatar Jan 16 '25 15:01 kube

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 avatar Jan 20 '25 16:01 vincent-thomas

@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.

askoufis avatar Jan 30 '25 02:01 askoufis

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!

MichaelDeBoey avatar May 08 '25 22:05 MichaelDeBoey