Closed predaytor closed 7 months ago
Also when using this strategy to import css - HMR does not work. Using side-effect import works fine.
This might be solved in 0.8.1
(https://github.com/HorusGoul/vite-plugin-stylex/releases/tag/vite-plugin-stylex%400.8.1) for Remix. I don't have a big enough project in Remix to try, but I added a bunch of tests to test both the build
and dev
environments. It should work.
Also when using this strategy to import css - HMR does not work. Using side-effect import works fine.
Wasn't able to reproduce this issue, both in tests and :thinking:
I'll close for now, let me know if that worked!
Can confirm ?url
import is working properly. But the HMR problem remains. I will open another issue when I find out the bug (maybe it's related to remix). Thx!
Found a problem, it is related to the use of preload link:
on initial dev startup:
<link rel="preload" href="/app/styles/index.css" as="style">
after hmr update:
<link rel="preload" href="http://localhost:3000/app/styles/index.css?t=1711437214384" as="style">
So that's definitely a problem with remix.
In the meantime, we can disable preloading for dev mode:
export const links: LinksFunction = () => [
...(!import.meta.env.DEV ? [{ rel: 'preload', href: $styles, as: 'style' }] : []),
];
The Vite
?url
import (https://github.com/vitejs/vite/pull/15259) is used to manually include the asset URL without a side-effect import.Running
pnpm dev
is fine, but the production build failed.Stackblitz (https://stackblitz.com/edit/remix-run-remix-mqrbqi?file=app%2Froot.tsx)
Console output: