-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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 instantiation from URLs #30780
Comments
IIRC we have prior art on accepting file urls for various APIs, but i don't remember which ones. |
The initial URL support for the I think a) is not a large concern here. |
b) has typically been also seen as a backwards-incompatible change. Perhaps to implement it that way upfront now though would be permissible. Then, if users really need a directory named file: they can convert the path into a URL. |
Support for That said a filename matching |
I used it multiple times. It is convenient in apps to always use |
Just having something like the following would work... new Worker(new URL(import.meta.url)); |
^ This approach is how |
The explicit goal is to let users use `import.meta.url` to re-load thecurrent module inside a Worker instance. Fixes: nodejs#30780
The explicit goal is to let users use `import.meta.url` to re-load thecurrent module inside a Worker instance. Fixes: #30780 PR-URL: #31664 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
The explicit goal is to let users use `import.meta.url` to re-load thecurrent module inside a Worker instance. Fixes: #30780 PR-URL: #31664 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
The explicit goal is to let users use `import.meta.url` to re-load thecurrent module inside a Worker instance. Fixes: nodejs#30780 PR-URL: nodejs#31664 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
The explicit goal is to let users use `import.meta.url` to re-load thecurrent module inside a Worker instance. Fixes: #30780 PR-URL: #31664 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
When creating workers from within modules, we don't have
__filename
or__dirname
so rather have to rely on import.meta.url, something like:To avoid the
fileURLToPath
call being necessary here, should we consider supporting URLs as input intonew Worker
?The text was updated successfully, but these errors were encountered: