-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Error when running Vite with import.meta in vite.config.js #19024
Comments
Same issue here when upgrading Svelte project from vite 5 to vite 6 |
The same thing happens with a new React project. npm create vite@latest my-react-app -- --template react |
Vue3 old projects also have similar issues when building new devices, with Node version 20.17.0 |
What's strange is that, a new Vite+Svelte+TS project created yesterday on Vite 6.0.3 did not have this issue even when upgraded to Vite 6.0.4, but a new Vite+Svelte+TS 6.0.4 project created today has this issue. Diffing the two including node modules seem to say that |
duplicates #19018 |
The same is happening with me in vite+react but I am using vite 6.0.3 |
It seems to be caused by the new version of |
Same thing happens with a new React project. X [ERROR] Expected identifier but found "import"
X [ERROR] Expected identifier but found "import"
X [ERROR] Expected identifier but found "import"
failed to load config from C:\vite\d\vite.config.js |
Duplicate of #19018 |
did you get the solution for that? |
npm i -D esbuild@0.24.0 This worked for me |
To avoid adding {
"name": "Your app",
"devDependencies": {
"vite": "^6.0.4",
},
"overrides": {
"vite": {
"esbuild": "0.24.0"
}
},
}
Then delete the |
Don‘t use vite 6 |
v6.0.5 pins esbuild to v0.24.0 which fixes this issue without having to mess with package.json. |
Describe the bug
I encountered an error when running a freshly created Vue 3 project with Vite. The project fails to start with the following errors in vite.config.js:
Reproduction
none
Steps to reproduce
Run npm init vue@latest to create a new Vue 3 project.
Select default options (Vue 3, no TypeScript, no router, no Pinia, etc.).
Navigate to the project folder and run npm install.
Run npm run dev to start the Vite development server.
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: