-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: Expected identifier but found "import" #4010
Comments
+1 |
Vite uses |
npm i -D [email protected] |
Happening to me as well, it broke the whole vite builds even the latest one. So, locking to version 0.24.0 temporarily fixes this. |
{
// ... 其他配置 ...
"resolutions": {
"esbuild": "0.24.0"
}
}
|
@yeyunwen works for me. Thanks. |
+1 |
I had this problem with both bun and node based projects, but installing esbuild 0.24.0 solved it only in the node based projects ... :( |
This worked for me. |
This works fine for me |
thanks |
Big shot, awesome. That's perfect |
|
This worked for me. Thank you. 0.24.1 breaks vite builds |
This works but why this happens |
Same error using tsup
Also worked for me. Hopefully they fix this quickly |
build errors with `[email protected]` - see issue evanw/esbuild#4010 (cherry picked from commit 2d5cfe94540b0e7da2749b9e8773d896b9d1827e)
* chore: minor improvements (#11) (cherry picked from commit 95cc6864758dc20a98f225a6f0d355e0dd52a2f2) * feature: add `jest` coverage file serving (#12) (cherry picked from commit 8cbde6366f3880c971d959b14c63391fbd923b6d) * fix: add `coverage` folder to ESLint ignored paths to avoid unnecessary warnings/errors (#13) (cherry picked from commit df6b7015840ab5a17d5d547547f961da75d414f2) * bump: add `[email protected]` to solve build errors (#14) build errors with `[email protected]` - see issue evanw/esbuild#4010 (cherry picked from commit 2d5cfe94540b0e7da2749b9e8773d896b9d1827e) * chore: regenerated `pnpm-lock.yaml` file
Describe what esbuild is doing incorrectly and what it should be doing instead.
When using
Vite
to create a new project, it fails to start properly. Downgradingesbuild
to version 0.24.0 resolves the issue.OS: Windows 10
Node.js Version: v22.12.0
PS C:\react-app> npm run dev
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:\react-app\vite.config.ts
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 (C:\react-app\node_modules\esbuild\lib\main.js:1476:15)
at C:\react-app\node_modules\esbuild\lib\main.js:945:25
at runOnEndCallbacks (C:\react-app\node_modules\esbuild\lib\main.js:1316:45)
at buildResponseToResult (C:\react-app\node_modules\esbuild\lib\main.js:943:7)
at C:\react-app\node_modules\esbuild\lib\main.js:970:16
at responseCallbacks. (C:\react-app\node_modules\esbuild\lib\main.js:622:9)
at handleIncomingPacket (C:\react-app\node_modules\esbuild\lib\main.js:677:12)
at Socket.readFromStdout (C:\react-app\node_modules\esbuild\lib\main.js:600:7)
at Socket.emit (node:events:524:28)
at addChunk (node:internal/streams/readable:561:12)
The text was updated successfully, but these errors were encountered: