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

Worker construction only works with relative paths #10252

Closed
7 tasks done
Snugug opened this issue Sep 26, 2022 · 1 comment
Closed
7 tasks done

Worker construction only works with relative paths #10252

Snugug opened this issue Sep 26, 2022 · 1 comment

Comments

@Snugug
Copy link
Contributor

Snugug commented Sep 26, 2022

Describe the bug

When using the new Worker(new URL() web worker construction, using a relative path (i.e. ./worker.js) will result in the worker being found just fine, but using an absolute path (i.e. /worker.js) will result in an error Failed to fetch a worker script., even if both resulted URLs point to the same file. I expect that because the two should resolve to the same file that it would work either way, especially as there is no documentation stating otherwise, but they appear to have different behavior.

Reproduction

https://stackblitz.com/edit/vitejs-vite-oguzf8?file=main.js,worker1.js,worker2.js,package-lock.json&terminal=dev

System Info

System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Max
    Memory: 10.19 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.17.0 - ~/.volta/tools/image/node/16.17.0/bin/node
    npm: 8.15.0 - ~/.volta/tools/image/node/16.17.0/bin/npm
  Browsers:
    Chrome: 105.0.5195.125
    Safari: 16.0
  npmPackages:
    vite: ^3.1.0 => 3.1.3

Used Package Manager

npm

Logs

No response

Validations

@bluwy
Copy link
Member

bluwy commented Sep 27, 2022

This should be fixed by #7837 coming in Vite 3.2

@bluwy bluwy closed this as completed Sep 27, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2022
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

2 participants