-
-
Notifications
You must be signed in to change notification settings - Fork 355
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
Fatal Error [ERR_REQUIRE_ESM]: require() of ES Module vite-ssr\server\pageFiles.mjs not supported #573
Comments
Other than Vite, are you using another bundler that is bundling What's the output of the following? $ cat dist/server/importBuild.cjs (I.e. the |
No, I run the "cross-env NODE_ENV=production ts-node ./server" command. The build process is just vite build. { |
I think that leads in the right direction; was finally able to reproduce it using the boilerpate. It's somewhere in my tsconfig settings; I'll test and report back. |
Ok, the message can be reproduced by adding 0.4.55 is the update that converts this from an error message to a complete break. Edit: a temporary workaround is to also add |
Neat, thanks for the comfy repro. That's quite unexpected, I'll have a look at it. FYI it should work since
|
I couldn't reproduce: https://github.com/brillout/vps-reprod-573. |
navigate to localhost:3000/thing. The app crashes as above for me. Edit: actually, this seems to crash for me in all cases (even visiting localhost:3000 after running Edit2: also failed on a separate Ubuntu computer. This works for you? |
I have the exact same problem.
Edit: I tried the boilerplate and I and the same error happened. |
@amirhoseynShourideh Are you using Vite 4? The update caused a similar error for me with Chakra, not related to VPS. |
@arthurgailes yes I do. |
Downgrade to version 3, and it should work again. The package authors will likely release a fix soon, if they haven't already. Chakra just did a few hours ago, so I doubt it will take MUI much longer. |
I downgraded to |
Only this, otherwise no, we're getting a bit off-topic: https://vite-plugin-ssr.com/invalid-esm |
@arthurgailes Thanks. I had to delete node_modules and reinstall to fix |
Did that fix the boilerplate for you? |
No It didn't. |
Alright, I could reproduce. The culprit is The workaround is to set |
Boilerplates updated, see c697843 to see how I solved it for the boilerplates. I think we can close this. Let me know if there is anything else. |
I recommend taking a look at TypeScript Execute (TSX) https://github.com/esbuild-kit/tsx to avoid ESM-related issues with ts-node. It worked out of the box for the project I am working on which is ESM only, in contrast to ts-node. |
@samuelstroschein Yea also thinking of TSX. Maybe even Deno... but I don't know how far they are with their npm compat layer. |
@brillout TSX works flawlessly. See TSX in action on the project I am working on https://gitpod.io/#https://github.com/inlang/inlang. RE: deno, lovely, but I expect several unforseen edge cases like this one. |
Last time I tried TSX I had issues with it. I'll give it another shot.
FYI https://twitter.com/biwanczuk/status/1607332213384974336. |
@samuelstroschein FYI privatenumber/tsx#167. The slowness of tsx is a no-go. I also don't like how tsx handles error (but I could live with that). Quite a pity, tsx seems really nice otherwise. |
I agree that'd be nice, it's just lower priority because the long term idea is for the user to use (something like) HatTip. But in the meantime it'd definitely be nice indeed. |
Description
This error occurs when routing to a page that I have not explicitly pre-rendered. (e.g. localhost/notAPage) It only occurs when serving the production build (SSG or SSR).
At some point between 0.4.54 and 0.4.60, this changed from merely printing to the console to causing my express server (basically a copy of the react boilerplace) to crash completely.
In 0.4.54:
In 0.4.60:
Error Message + Error Stack
No response
The text was updated successfully, but these errors were encountered: