Skip to content
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

esbuild-browser example using coi #1424

Closed
wants to merge 1 commit into from

Conversation

jraymakers
Copy link
Contributor

@jraymakers jraymakers commented Sep 26, 2023

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 left http-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.

@jraymakers jraymakers force-pushed the jray/example-using-coi branch from dc6a10d to 2ae4259 Compare October 3, 2023 19:13
@jraymakers jraymakers marked this pull request as ready for review October 3, 2023 20:51
@jraymakers
Copy link
Contributor Author

This was originally just a demonstration PR, but I'd like to actually merge it.
It provides a simple working example of how to use the COI build. It works on all major browsers.
It only changes one example, and it's purely additive.

@carlopi
Copy link
Collaborator

carlopi commented Nov 9, 2023

I did not manage to have this properly work on my setup, I will give it another try, but it seems this is just moving the problem a bit further.

@jraymakers
Copy link
Contributor Author

I did not manage to have this properly work on my setup, I will give it another try, but it seems this is just moving the problem a bit further.

I'm interested to hear what problems you encounter. For reference, I'm using an M2 Mac and testing in Chrome.

If there are problems with COI in some environments, then an example like this could make them easier to discover and diagnose.

@carlopi
Copy link
Collaborator

carlopi commented Nov 20, 2023

I think this can be closed in favor of #1501, thanks a lot @jraymakers for bringing this in.

@carlopi carlopi closed this Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants