Cannot build my app, Vite says: "Module externalized for browser compatibility" #9532
Replies: 2 comments
-
Ok, I thought no client code was importing Now the problem is I'm loading the cookie secret from |
Beta Was this translation helpful? Give feedback.
0 replies
-
Found the bug: we were exporting a back-end only function from a resource route in addition to the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everybody, I'm unable to build my app, Vite gives a bunch of warnings regarding Node.js imports that are only used in the backend, no client code is using this, but still gaves me the message "Module externalized for browser compatibility".
The error though is about not being able to find fields on imported Node.js modules that are there, like for example
process.env
.I checked my whole code base to see if maybe I'm importing
config.js
from a client module, but not. All the modules that useconfig.js
like underapp/only.server/
folder, except for the entry point, which lives at the root of the project:server.js
. It's an Express template-based app.I thought maybe Vite is confused and renamed
config.js
toconfig.server.js
, and then the error became:I don't get why I'm getting this error, I thought that by naming my folder
only.server
I was covered from this kind of errors.What can I do to further investigate this problem and, hopefully, solve it? Cause right now I cannot deploy my app, which is critical.
Beta Was this translation helpful? Give feedback.
All reactions