Thanks to visit codestin.com
Credit goes to github.com

Skip to content

new Worker(import.meta.url) doesn't work as expected #12638

Description

@RReverser

Bug report

I have code like this:

new Worker(import.meta.url)

where module spawns itself as a Worker when multithreading is enabled.

What is the current behavior?

Webpack transforms import.meta.url into a file: URI, which fails to get spawned in runtime.

What is the expected behavior?

Handling of

new Worker(import.meta.url)

should be equivalent to

new Worker(new URL('explicit-own-filename.js', import.meta.url))

which Webpack already supports.

Other relevant information:
webpack version: 5.20.1

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions