Reputation: 2323
I have prepared my vue3 project with vite. In localhost, if I run npm run dev
it is working properly and running the website file. If I run npm run build
then it is not working. I have attached the error message as an image. Please check
TIA
Upvotes: 0
Views: 6149
Reputation: 2323
In some npm packages, I have used in my project have some features were added from the latest EcmaScript. Like async generator functions, for-await, etc. Vite used the esbuild library to bundle javascript. If we don’t set the target, the transform by esbuild doesn’t work properly. To solve this issue need to set a target in the build command (package.json)
vite build --target=es2020
Upvotes: 2