Declare "type": "module"
in templates.
#4535
Labels
duplicate
This issue or pull request already exists
enhancement: pending triage
wontfix
This will not be worked on
Clear and concise description of the problem
Vite is all about es modules. Imagine you run
node vite.config.js
with the following file, it won't work:You do this, to get a sense of how Vite plugins (their API) work.
But it fails, because it uses
import
syntax.node
by default expects commonJS. This applies to all other scripts.js
in the project. You write some es6-es2021 code and it works on the client, but doingnode script.js
fails by default. Is this to scare off newbies?Suggested solution
Adding
"type": "module"
to thepackage.json
in scaffoldings makes more sense I think.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: