Skip to content

[Bug]: Incorrect parsing of ternary operators #8676

@hood

Description

@hood

Reproduction link or steps

Repro here, even though I cannot seem to build the project as I’m getting the following error when attempting to run pnpm run build:

ERROR  Error happened while loading config.                                                            

  

  [cause]: _0x2532d8[_0x4bdff6(0xa06)] is not a function. (In '_0x2532d8[_0x4bdff6(0xa06)](_0x2de590)', '_0x2532d8[_0x4bdff6(0xa06)]' is undefined)

      @https://rrdujzjerun-vqoi.w-corp-staticblitz.com/blitz.3b7d1e54.js:31:780637
      _instantiate@https://rrdujzjerun-vqoi.w-corp-staticblitz.com/builtins.4a5e7736.js:170:3375

and the REPL gives this error instead:

Cannot access 'rolldown' before initialization.

    at build (https://repl.rolldown.rs/api/proxy/@1.0.0-rc.9/dist/index.browser.mjs:67:31)
    at build (https://repl.rolldown.rs/api/proxy/@1.0.0-rc.9/dist/index.browser.mjs:63:22)
    at  (https://repl.rolldown.rs/_nuxt/ssqACzNc.js:170:23077)

What is expected?

Ternaries should get parsed correctly.

What is actually happening?

Parsing of ternary looks broken on 1.0.0-rc.9 (used trough vite@8.0.0).

Attempting a quick build test on an app yielded:

error during build:
Build failed with 1 error:

[builtin:vite-transform] Error: Expected `:` but found `;`
     ╭─[ src/components/FooBar.tsx:103:6 ]
     │
 100 │     const getFormError = typeof formErrors !== 'object' ? () => ({}) : (index: number): Errors<FooBarForm> => {
     │                                                         ┬
     │                                                         ╰── Conditional starts here
     │
 103 │     };
     │      ┬
     │      ╰── `:` expected
─────╯

    at aggregateBindingErrorsIntoJsError (file:///foobar/node_modules/.pnpm/rolldown@1.0.0-rc.9/node_modules/rolldown/dist/shared/error-CP8smW_P.mjs:48:18)
    at unwrapBindingResult (file:///foobar/node_modules/.pnpm/rolldown@1.0.0-rc.9/node_modules/rolldown/dist/shared/error-CP8smW_P.mjs:18:128)
    at #build (file:///foobar/node_modules/.pnpm/rolldown@1.0.0-rc.9/node_modules/rolldown/dist/shared/rolldown-build-4YnQkA76.mjs:3311:34)
    at async buildEnvironment (file:///foobar/node_modules/.pnpm/vite@8.0.0_@types+node@24.1.0_esbuild@0.27.3_terser@5.46.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/node.js:32794:64)
    at async Object.build (file:///foobar/node_modules/.pnpm/vite@8.0.0_@types+node@24.1.0_esbuild@0.27.3_terser@5.46.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/node.js:33216:19)
    at async Object.buildApp (file:///foobar/node_modules/.pnpm/vite@8.0.0_@types+node@24.1.0_esbuild@0.27.3_terser@5.46.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/node.js:33213:153)
    at async CAC.<anonymous> (file:///foobar/node_modules/.pnpm/vite@8.0.0_@types+node@24.1.0_esbuild@0.27.3_terser@5.46.0_yaml@2.8.2/node_modules/vite/dist/node/cli.js:778:3) {
  errors: [Getter/Setter]
}
 ELIFECYCLE  Command failed with exit code 1.

System Info

System:
    OS: macOS 26.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 76.88 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.13.1 - /Users/foobar/.local/state/fnm_multishells/50891_1745059572284/bin/node
    Yarn: 1.22.22 - /Users/foobar/.local/state/fnm_multishells/50891_1745059572284/bin/yarn
    npm: 11.8.0 - /Users/foobar/.local/state/fnm_multishells/50891_1745059572284/bin/npm
    pnpm: 10.32.0 - /opt/homebrew/bin/pnpm
    Deno: 2.5.6 - /Users/foobar/.deno/bin/deno
  Browsers:
    Chrome: 145.0.7632.160
    Chrome Canary: 148.0.7733.0
    Firefox Developer Edition: 148.0
    Safari: 26.3.1

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions