-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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" #53991
Comments
Can confirm this, I'm getting the same issue. From what I have gathered so far, Vite v6 which has some breaking changes regarding ESM modules. |
you can update to vite@6.0.5, we've pinned esbuild to 0.24.0 until the regression is fixed upstream |
This was a temporary upstream issue, as @patak-dev mentioned, that has been addressed in both Vite and esbuild. Update your dependencies and you should be good to go. |
p.s., thanks for the fix, @patak-dev ❤️ |
Indeed, Updating vite to 6.0.5 does the trick :) |
Laravel Version
11.36.1
PHP Version
8.3.14
Database Driver & Version
No response
Description
When creating a new project and running the npm run build or npm run dev, I get the following error
npm run build ✔ at 11:20:23
✘ [ERROR] Expected identifier but found "import"
✘ [ERROR] Expected identifier but found "import"
✘ [ERROR] Expected identifier but found "import"
failed to load config from /Users/jurgen/code/project/vite.config.js
error during build:
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 (/Users/jurgen/code/project/node_modules/esbuild/lib/main.js:1476:15)
at /Users/jurgen/code/project/node_modules/esbuild/lib/main.js:945:25
at runOnEndCallbacks (/Users/jurgen/code/project/node_modules/esbuild/lib/main.js:1316:45)
at buildResponseToResult (/Users/jurgen/code/project/node_modules/esbuild/lib/main.js:943:7)
at /Users/jurgen/code/project/node_modules/esbuild/lib/main.js:970:16
at responseCallbacks. (/Users/jurgen/code/project/node_modules/esbuild/lib/main.js:622:9)
at handleIncomingPacket (/Users/jurgen/code/project/node_modules/esbuild/lib/main.js:677:12)
at Socket.readFromStdout (/Users/jurgen/code/project/node_modules/esbuild/lib/main.js:600:7)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
Steps To Reproduce
laravel new project
cd project
npm install && npm run build
Tested it out on macOS and Windows with Laravel Herd
Node version: 22.11.0
Npm version: 10.9.0
The text was updated successfully, but these errors were encountered: