-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
?url
CSS imports used in links
are not bundled correctly in production
#7786
Comments
Workaround: use side-effect // app/root.tsx
- import { cssBundleHref } from "@remix-run/css-bundle";
- import tailwindHref from "~/tailwind.css?url";
+ import "~/tailwind.css";
- export const links = () => [
- ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
- { rel: "stylesheet", href: tailwindHref },
- ]; The difference in how |
EDIT: Added related Vite issues to this issue's description. |
@684efs3 I wasn't able to reproduce your issue. Could you please share a repro? |
I'm experiencing the same issue as @684efs3 @markdalgleish Looks like with the express server and tailwind with autoprefixer, the styles flash: https://github.com/c43721/test-vite I'm also seeing the styles from the component be completely overridden by the imported tailwind styles. That's unexpected from me (though I've been out of the loop for a while so maybe this is expected 👍). This is during dev, did not test running production. |
This is still broken in 2.4.1 This works for me but breaks the Links component/makes it impossible to use it for imported CSS. A PR is needed to properly integrate them (link component and CSS side effects?). I also cannot confirm if |
Sorry, what's still broken exactly? If you're referring to the original issue, it's an upstream issue in Vite that won't be fixed by a Remix release. This issue is only here so that we have a single place to link to and track all related Vite issues.
Sorry, I'm not quite following. Do you have an example of what's breaking?
The |
IIRC, the In dev I can only use side-effects and have vite bundle for me. |
It looks like the PR vitejs/vite#15259 solves it, but it hasn't been merged yet. |
After a couple of hours debugging, I reached the same issue with css. |
vitejs/vite#15259 was merged earlier today. Just waiting for a Vite release than includes it now |
Vite's fix for this is currently available in v5.1.0-beta.0: https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#510-beta0-2024-01-15 |
Closing as Vite v5.1 has shipped. |
What version of Remix are you using?
v0.0.0-nightly-0c99349-20231027
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
Expected Behavior
Processed styles show up in production
Actual Behavior
Processed styles only show up in development
Related Vite issues
?url
flag causes the import to fail vitejs/vite#2522The text was updated successfully, but these errors were encountered: