Skip to content

Unable to package normal files in web worker #19073

Open
@just-ads

Description

Describe the bug

The generated worker file contains es syntax
export function __vite_legacy_guard()
image
Cannot be used normally in worker

Reproduction

https://stackblitz.com/edit/vitejs-vite-ixsfq5p1?file=main.js

Steps to reproduce

1.npm install
2.npm run build

System Info

System:
    OS: Windows 10 10.0.19042
    CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
    Memory: 3.29 GB / 15.95 GB
  Binaries:
    Node: 20.11.0 - E:\Program Files\nodejs\node.EXE
    npm: 10.2.4 - E:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (127.0.2651.74)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @vitejs/plugin-legacy: ^6.0.0 => 6.0.0 
    @vitejs/plugin-react: ^4.3.4 => 4.3.4 
    vite: ^6.0.3 => 6.0.3

Used Package Manager

npm

Logs

No response

Validations

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions