-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
Problem with "type" : "module" option in package.json #61
Comments
Added a pull request how I solved it in vite-ssg as an option without breaking changes. |
In the meantime i canceled my pr from above and instead changed the rollup options in rollupOptions: {
output: {
entryFileNames: '[name].cjs',
},
}, If you want me to create a pr, just let me know. |
That looks like a much better solution, PR welcome 👍 (we could do that without an option but check the package.json directly) |
Good idea. I used read-pkg-up package to determine the nearest package.json file. So we should not need an option for this. |
I have a project with es modules enabled in the package.json.
I ran the command
vite-ssg build
and got the following errot:Error [ERR_REQUIRE_ESM]: Must use import to load ES Module
I figured out the problem is that the generated file in the .vite-ssg-temp folder is a common.js file with file ending
.js
. I changed the file ending to.cjs
and it worked for me.The text was updated successfully, but these errors were encountered: