-
Notifications
You must be signed in to change notification settings - Fork 445
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
Expected identifier but found "import" #641
Comments
same |
It's caused by esbuild and there's a solution: install esbuild before v0.24.1 as dev dependency and restart dev server. more detail |
I'm getting this error when doing an incredibly default install choosing all the default options via: $ npm create vue@latest
> npx
> create-vue
Vue.js - The Progressive JavaScript Framework
√ Project name: ... npm_create_vue_is_broken
√ Add TypeScript? ... No / Yes
√ Add JSX Support? ... No / Yes
√ Add Vue Router for Single Page Application development? ... No / Yes
√ Add Pinia for state management? ... No / Yes
√ Add Vitest for Unit Testing? ... No / Yes
√ Add an End-to-End Testing Solution? » No
√ Add ESLint for code quality? » No
Scaffolding project in G:\dev\npm_create_vue_is_broken...
Done. Now run:
cd npm_create_vue_is_broken
npm install
npm run dev
$ cd npm_create_vue_is_broken/
$ npm install
added 145 packages, and audited 146 packages in 17s
42 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$ npm run dev
> [email protected] dev
> vite
X [ERROR] Expected identifier but found "import"
(define name):1:0:
1 │ import.meta.dirname
╵ ~~~~~~
X [ERROR] Expected identifier but found "import"
(define name):1:0:
1 │ import.meta.filename
╵ ~~~~~~
X [ERROR] Expected identifier but found "import"
(define name):1:0:
1 │ import.meta.url
╵ ~~~~~~
failed to load config from G:\dev\npm_create_vue_is_broken\vite.config.js
error when starting dev server:
Error: Build failed with 3 errors:
(define name):1:0: ERROR: Expected identifier but found "import"
(define name):1:0: ERROR: Expected identifier but found "import"
(define name):1:0: ERROR: Expected identifier but found "import"
at failureErrorWithLog (G:\dev\npm_create_vue_is_broken\node_modules\esbuild\lib\main.js:1476:15)
at G:\dev\npm_create_vue_is_broken\node_modules\esbuild\lib\main.js:945:25
at runOnEndCallbacks (G:\dev\npm_create_vue_is_broken\node_modules\esbuild\lib\main.js:1316:45)
at buildResponseToResult (G:\dev\npm_create_vue_is_broken\node_modules\esbuild\lib\main.js:943:7)
at G:\dev\npm_create_vue_is_broken\node_modules\esbuild\lib\main.js:970:16
at responseCallbacks.<computed> (G:\dev\npm_create_vue_is_broken\node_modules\esbuild\lib\main.js:622:9)
at handleIncomingPacket (G:\dev\npm_create_vue_is_broken\node_modules\esbuild\lib\main.js:677:12)
at Socket.readFromStdout (G:\dev\npm_create_vue_is_broken\node_modules\esbuild\lib\main.js:600:7)
at Socket.emit (node:events:524:28)
at addChunk (node:internal/streams/readable:561:12) |
Yes, this is a regression in esbuild 0.24.1 which was released 2 hours ago. We can't do much on create-vue side, I'll let you watch the esbuild issue. They'll probably release a fix soon. |
Vite has released a new pin esbuild version; the latest version is normal. |
Awesome, let's close this then. |
Describe the bug
When running
pnpm dev
in a freshly created project, the following error occurs:Expected behavior
The dev server starts successfully.
How to reproduce
Go to either of these:
The text was updated successfully, but these errors were encountered: