We need to design/decide what adding a script elements via worker-dom does. This may also need to be configurable.
Currently it would just do it and execute the script on the main thread. Which would be right for some use cases. But for other cases, such as when using code splitting, one might want to run the script inside the worker.
In that case, we may "neuter" the script element and instead use importScript to load the script. I believe that importScript is sync, so we may need to instead fetch the script and then call importScript with a blob (is that supported?)
We need to design/decide what adding a script elements via worker-dom does. This may also need to be configurable.
Currently it would just do it and execute the script on the main thread. Which would be right for some use cases. But for other cases, such as when using code splitting, one might want to run the script inside the worker.
In that case, we may "neuter" the script element and instead use
importScriptto load the script. I believe thatimportScriptis sync, so we may need to insteadfetchthe script and then callimportScriptwith a blob (is that supported?)