Skip to content

[V3] Some imports fail inside of workers in a production build #8946

@davidwallacejackson

Description

@davidwallacejackson

Describe the bug

I'm instantiating a web worker from the monaco-yaml library. In v2, nothing unusual happens when I do this. In v3 beta 6, dev works normally, but in a build, the build fails with this error:

[vite:worker] 'Schema' is not exported by node_modules/js-yaml/index.js, imported by node_modules/monaco-yaml/lib/esm/_deps/yaml-language-server/lib/esm/languageservice/utils/parseUtils.js

Reproduction

https://stackblitz.com/edit/vitejs-vite-6xf52e?file=package.json,src%2FApp.tsx,src%2Fmonaco-setter.ts,src%2Fvite-env.d.ts,README.md&terminal=dev

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /bin/yarn
    npm: 7.17.0 - /bin/npm
  npmPackages:
    @vitejs/plugin-react: ^1.3.2 => 1.3.2 
    vite: 3.0.0-beta.6 => 3.0.0-beta.6

Used Package Manager

npm

Logs

No response

Validations

Metadata

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