0

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

enter image description here

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.