Skip to content
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

build fail due to esbuild 0.24.1 dependency #19026

Closed
7 tasks done
KonradHoeffner opened this issue Dec 20, 2024 · 1 comment
Closed
7 tasks done

build fail due to esbuild 0.24.1 dependency #19026

KonradHoeffner opened this issue Dec 20, 2024 · 1 comment

Comments

@KonradHoeffner
Copy link

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

  1. npm create vite@latest (choosing "esbug" as project name and vanilla JS)

npx
create-vite

✔ Project name: … esbug
✔ Select a framework: › Vanilla
✔ Select a variant: › TypeScript

  1. cd esbug
  2. esbug$ echo "import { fileURLToPath } from 'url'; export default (_) => { return {};};" > vite.config.js
  3. npm install
  4. npm run dev

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

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)

Validations

@KonradHoeffner
Copy link
Author

Sorry, I didn't see that this already exists in #19018.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant