Closed danestves closed 8 months ago
Same error from this issue reported too 👉 https://github.com/remix-run/remix/issues/8814 I'm using CSS URLs too
Can confirm that build is success if I don't use css?url
imports for links
function
Closed my issue as a dupe.
For reference, this broke in @remix-run/dev@2.7.0-pre.2
and carried through to 2.7.0 stable (it was fine in @remix-run/dev@2.7.0-pre.1
).
Can confirm that I am experiencing the same issue but my build fails with different fatal error when I try to remove ?url
.
vite v5.1.3 building for production...
✓ 95 modules transformed.
x Build failed in 392ms
Error [RollupError]: "default" is not exported by "app/tailwind.css", imported by "app/root.tsx".
file: /WebstormProjects/project/app/root.tsx:7:7
5: import robotoFlex from "@fontsource-variable/roboto-flex/index.css?url";
6:
7: import styles from "./tailwind.css";
Thanks for raising this. I've found the problem, I should have a fix ready soon.
@pajasevi Your issue is expected when removing ?url
from the CSS import since Vite won't provide a default export anymore.
@markdalgleish this issue also occurs if you add extra entry points that are css files to the vite pipeline via plugins:
e.g.:
function extraEntryPoints(): PluginOption {
return {
name: "extra-entry-points",
apply: "build",
config(config, { command }) {
if (command !== "build") {
return;
}
return {
build: {
rollupOptions: {
input: ["app/entry.inter.css"],
},
},
};
},
};
}
@robertjpayne Ah, that's interesting. If the build passes, how would that extra CSS file be part of your Remix app?
@markdalgleish it just gets processed as it's own entry point so it gets put into the assets folder and added to the vite manifest. It was working in 2.6.0 and earlier. Attached a really really minimal example.
Though I did see there is a PR (https://github.com/remix-run/remix/pull/8818) for direct support without having to use a plugin to do so.
For what its worth we have an unusual integration as we are using Vite to pre-process/bundle assets for other parts of our existing web stack and using Remix in SPA mode to power specific paths that require more interaction.
This just bit me too. Excited about the vite support!
Yeah, I'm experiencing same issue. It happens with any css file that is imported using Links
if using ?url
which is required for Vite.
import anything from "./anyfile.css?url";
export const links: LinksFunction = () => [
{ rel: "stylesheet", href: anything }
];
@robertjpayne Thanks for sharing that repro. I've just confirmed that the PR fixing this issue also fixes your issue: https://github.com/remix-run/remix/pull/8829
Hi! Please don't mind me cause I am new to this, but how do you find out that the error is caused by the css import with url
?
@Lenghak Because if you remove the ?url
the error goes away :). It takes a bit of trial and error but basically I'll have a hypothesis for what might be causing the issue. If it isn't the issue, I'll keep trying different possibilities trying to isolate the problem further.
Right, sir. So it does require some experiences in order to come up with some hypothesizes or even have a sense to suspect where the error could be. I, personally, wouldn't think that the it comes from the CSS cause the error shows entirely different message. Thank you for your explanation sir, I really appreciate it.
This is fixed by https://github.com/remix-run/remix/pull/8829, it'll be out in the next patch release.
🤖 Hello there,
We just published version 2.7.2
which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!
Thanks!
@danestves @robertjpayne Can you please confirm that v2.7.2 fixes your issue?
@markdalgleish It fixed it, thank you. ❤️
I can confirm this is fixed for me as well. Thank you guys.
Fixed thanks!
Reproduction
Using this template 👉 https://github.com/kiliman/remix-vite-template that doesn't differ very much from the official one 👉 https://github.com/remix-run/remix/tree/main/templates/vite-express
It gives the following error when running
remix vite:build
:This only happens to me after upgrading to
2.7.0
of RemixSystem Info
Used Package Manager
npm
Expected Behavior
Build normally like the previous version (2.6.0)
Actual Behavior
Breaking the builds