You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
esbug$ npm run dev
> [email protected] dev
> vite
✘ [ERROR] Expected identifier but found "import"
(define name):1:0:
1 │ import.meta.dirname
╵ ~~~~~~
✘ [ERROR] Expected identifier but found "import"
(define name):1:0:
1 │ import.meta.filename
╵ ~~~~~~
✘ [ERROR] Expected identifier but found "import"
(define name):1:0:
1 │ import.meta.url
╵ ~~~~~~
failed to load config from /tmp/esbug/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 (/tmp/esbug/node_modules/esbuild/lib/main.js:1476:15)
at /tmp/esbug/node_modules/esbuild/lib/main.js:945:25
at runOnEndCallbacks (/tmp/esbug/node_modules/esbuild/lib/main.js:1316:45)
at buildResponseToResult (/tmp/esbug/node_modules/esbuild/lib/main.js:943:7)
at /tmp/esbug/node_modules/esbuild/lib/main.js:970:16
at responseCallbacks.<computed> (/tmp/esbug/node_modules/esbuild/lib/main.js:622:9)
at handleIncomingPacket (/tmp/esbug/node_modules/esbuild/lib/main.js:677:12)
at Socket.readFromStdout (/tmp/esbug/node_modules/esbuild/lib/main.js:600:7)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:559:12)
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
vite has a transitive dependency on esbuild "^0.24.0", which includes the broken esbuild 0.24.1.
The bug is described in evanw/esbuild#4012.
Reproduction
https://stackblitz.com/edit/vitejs-vite-nl3amizq?file=package.json
Steps to reproduce
✔ Project name: … esbug
✔ Select a framework: › Vanilla
✔ Select a variant: › TypeScript
esbug$ echo "import { fileURLToPath } from 'url'; export default (_) => { return {};};" > vite.config.js
Adding
"esbuild": "0.24.0"
to the dev dependencies in package.json is a workaround that prevents this issue.System Info
System: OS: Linux 6.12 Arch Linux CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900K Memory: 21.57 GB / 31.13 GB Container: Yes Shell: 5.9 - /bin/zsh Binaries: Node: 23.4.0 - /usr/bin/node Yarn: 1.22.22 - /usr/bin/yarn npm: 10.9.2 - /usr/bin/npm pnpm: 9.15.1 - /usr/bin/pnpm Browsers: Chromium: 131.0.6778.204 npmPackages: vite: ^6.0.3 => 6.0.4
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: