esbuild-browser example using coi #1424
Closed
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.
Add the COI build to the esbuild-browser example.
In order for this to work, we need to serve the page with the COI headers (COEP & COOP). Since it doesn't appear that
http-server
supports custom headers, I added an alternate HTTP server,serve
, along with configuration to set these headers. I've lefthttp-server
in place, so the non-COI case can still be tested easily.I've tested this in Chrome, Firefox, and Safari on an M2 Mac (latest versions of all browsers & OS), and it works fine with the basic query in the example. I have not tested other queries. In Chrome and Firefox, I do see multiple (4) network requests for the pthread worker script, which is evidence that multiple threads are being started. I don't see this in Safari; I don't know whether that means multiple threads are not being used, or just that Safari reports this information differently.