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

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

Open
RReverser opened this issue Feb 9, 2021 · 8 comments
Open

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

RReverser opened this issue Feb 9, 2021 · 8 comments

Comments

@RReverser
Copy link
Contributor

RReverser commented Feb 9, 2021

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

@luvsta
Copy link

luvsta commented Mar 23, 2021

script tag must be support ESM.

@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

Still valid

@RReverser
Copy link
Contributor Author

Having thought about this a bit more, while I think it would be useful, it's likely not the most uncommon usecase and other bundlers don't seem to support this either. To keep consistency I suppose I'll close it.

@alexander-akait
Copy link
Member

alexander-akait commented Jun 23, 2021

@RReverser I think we can keep open, for me it is feature/enhancement than bug

@devongovett
Copy link

and other bundlers don't seem to support this either

FYI I just implemented support for this in Parcel (see link above). Came across this issue while I was researching so thought I would let you know. 😉

@RReverser
Copy link
Contributor Author

and other bundlers don't seem to support this either

FYI I just implemented support for this in Parcel (see link above). Came across this issue while I was researching so thought I would let you know. 😉

Ah thanks :)

@webpack-bot
Copy link
Contributor

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants