Use simple import.meta.url for worker creation #23889
Open
+227
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This needs to be tested under various bundlers. Spun out from #23804 . Allows for scripts to be renamed after compilation.
Vite and (unreleased) Webpack and (I believe) Parcel allow for the form
new Worker(import.meta.url)
, which simplifies the new worker creation in libpthread and avoids the need for using a macro to expand the current script name (which makes the generated code fragile).I’ve taken the opportunity to expand the test coverage for permutations of bundlers and mainScriptUrlOrBlob with and without threads (qua #23890 ), but if this feels redundant then the change in libpthread is enough.