Closed lautiamkok closed 1 year ago
Yeah I haven't had time to test this with Vite 4 yet. PRs are welcome!
We are really looking forward to vite 4 support
Please try the new v0.17.0
@frandiox Got the following error when starting the app after build:
Server started: http://localhost:3000
(node:37951) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/.../dist/server/main.js:1
import { defineComponent, ref, onMounted, inject, createApp, useSSRContext, resolveComponent, withCtx, createTextVNode, toDisplayString } from "vue";
^^^^^^
SyntaxError: Cannot use import statement outside a module
So I have to change this json file manually:
// ./dist/server/package.json
{
"main": "main.js",
"type": "commonjs",
"ssr": {
"assets": [
"assets",
"error.html",
"favicon.ico",
"static"
]
}
}
Change "type": "commonjs",
to "type": "module",
.
Then everything is working perfectly.
Could you please automate that?
Thanks for your hard work!
@lautiamkok good catch, I forgot the default changed from CJS to ESM in Vite 3. It should be fixed in the new 0.17.1
release.
@frandiox thanks for fixing that and making the new release! It now works perfectly and I don't see any more errors :-D
Having trouble installing it with Vite 4. Error below:
If I forced it:
Thanks