Skip to content

Formatting of `new URL in separate line is not parsed correctly #21315

@wclr

Description

@wclr

Describe the bug

This code works as expected:

const worker = new Worker(    
    new URL ("../some-loooooooooooooooooong-file-path-of -module-name.js", import.meta.url),
    { type: "module" },
  )

This code formatted with prettier, doesn't handle Worker url in Build mode (it works in Dev)

const worker = new Worker(    
    new URL(
      "../some-loooooooooooooooooong-file-path-of -module-name.js",
      import.meta.url,
    ),
    { type: "module" },
  )

tested with: rolldown-vite

Reproduction

https://stackblitz.com/edit/vitejs-vite-yvv6vfy8?file=index.html&terminal=dev

Steps to reproduce

No response

System Info

vite/7.2.11 win32-x64 node-v24.12.0

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions