-
Notifications
You must be signed in to change notification settings - Fork 29k
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
Being able to do import(blobUrls)
#47573
Comments
|
Does importing a blob work in other JS runtimes? It doesn't seem to in Firefox. Are there WPT tests that cover this? |
To answer my own question: yes, there are |
Yes... i have done it many times in browsers to create dynamic code that i then import... there are many other developer who dose this too. things like sql.js and JSZip think both are creating a hybrid solution that takes it's own minified source code and create a separate thread in order to not block havy calculations. kinda like: function ctx() { ... }
const blob = blob([ctx.toString(), `${ctx.name}()`])
const url = URL.createObjectURL(blob)
import(url)
new Worker(url)works OK, as long as the function is "pure" and don't references any variable outside of it's own function JSFiddle and other code playgrounds certainly benefit of using I just worked around this issue in my web worker polyfill And b/c blob urls are not working via cross threads: #46557 so i guess ☝️ is a blocker... |
|
I could add to that i would also like to be able to do: const url = URL.createObjectURL(blob)
new worker_threads.Worker(url, { type: 'module' })but that maybe will be a own issue in itself... |
|
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
|
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment. For more information on how the project manages feature requests, please consult the feature request management document. |
|
@RedYetiDev I would like this as well. All web browsers support this, Deno supports this, Bun supports this. Node is the black sheep |
|
Hey, I don't think I've interacted with this issue yet, was there a specific reason for pinging me? |
It said that you removed this from Node.js feature requests, so I thought you would be the one to contact |
|
Ahh okay, no problem, I was doing a bit of cleanup. |
|
I've been working on this a bit today, and I think I almost have it down. I've assigned myself to prevent other users from doing work thats already been done, I'd hate to see anyone's time go to waste. |


What is the problem this feature will solve?
tried doing:
but failed with:
What is the feature you are proposing to solve the problem?
being able to import dynamic generated code...
What alternatives have you considered?
converting it to a
data:url works as a work around...The text was updated successfully, but these errors were encountered: