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

Web Workers in a project with experiments.outputModule = true call importScripts despite being loaded with {type: "module"} #17870

Open
GingerIndustries opened this issue Dec 18, 2023 · 3 comments

Comments

@GingerIndustries
Copy link

GingerIndustries commented Dec 18, 2023

Bug report

What is the current behavior?

In a project with experiments.outputModule = true, the following code:

// main code
new Worker(new URL("<worker path>", import.meta.url))
// worker code
import { Stuff } from "some-really-big-module-that-gets-its-own-chunk"

will generate a main file that calls new Worker("<processed URL>", { type: "module" }), but a worker that calls importScripts() to load some-really-big-module-that-gets-its-own-chunk. This results in an error when the worker is loaded.

Reproduce

A minimum viable example may be found at https://github.com/GingerIndustries/webworker-mre.

What is the expected behavior?

Workers loaded in a project under these conditions should only use ES module imports to load dependencies.

Other relevant information:
webpack version: 5.89.0
Node.js version: 18.13.0
Operating System: Debian Bookworm
Additional tools: None

GingerIndustries added a commit to Vyxal/vyxal.github.io that referenced this issue Dec 18, 2023
@alexander-akait
Copy link
Member

I want to say it is a feature, we don't support ES module output for workers right now

@webpack-bot
Copy link
Contributor

This issue had no activity for at least three months.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@alexander-akait
Copy link
Member

bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Priority - Medium
Development

No branches or pull requests

3 participants