-
Notifications
You must be signed in to change notification settings - Fork 3
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
[QUESTION]: production crashes on Windows instance #15
Comments
It's a limitation of older Node.js versions: you cannot load ESM from CJS. Update your Node.js version, follow the recommendation provided by Node.js, or use ESM instead of CJS. Closing as this isn't related to vike-node nor do I see potential for vike-node to improve DX regarding this Node.js behavior. |
@brillout I understand about the ESM issue, my question wasn't related to that specifically, the issue wasn't node or my version since I am using Node v20, the issue is the path error:
For some reason, when I do my workaround to load ESM modules and the file is located in my root folder instead of inside |
I ain't sure I understand. Minimal reproduction welcome. |
This doesn't come from Vike nor vike-node, so I'm inclined to think it's a user-land issue not a vike(-node) one. |
Here is a working repo: https://github.com/simplecommerce/vike-node-example You can clone and npm i. Then simply run
If you run Both cjs files are created by me as a workaround to load the index.mjs. It was a suggestion I found online to run ESM on iis-node. |
Indeed, I can reproduce. It seems like |
@simplecommerce I'm taking some time to work on this as I guess it isn't a blocker. If you disable standalone mode I expect the error to go away. But feel free to let me know if it's a blocker for you to disable standalone mode. |
No problem, I can't disable standalone mode, but it isn't really a blocker since there is a workaround by moving the file in the |
Hi,
I am testing the build for production on both Linux and Windows.
The same build runs perfectly on Linux (NGINX).
But on Windows, when I attempt to load the site, it crashes with this error:
I am using Windows NODE (Azure Web App environment).
I cannot load the
dist/server/index.mjs
because it gives me this error:So in order to bypass this, I created a
main.cjs
file in mywwwroot
with the following:This worked in my previous setup which I was using vite standalone plugin with vavite.
But on vike-node I get the crash error.
It works if I move my
main.cjs
from the root, to thedist/server
folder and change my import.I assume its a configuration issue?
Any help is appreciated.
The text was updated successfully, but these errors were encountered: