Handle browser code at build time (vs runtime) #679
Merged
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.
Fixes https://github.com/pubkey/broadcast-channel/issues/636
I had to include #678 in this PR to be able to get anything done. If you'd prefer to merge that one first, I can rebase this one afterwards to drop those changes out of this PR
jsnext:main
has been deprecated in favor ofmodule
so remove itbrowser
refers to the client-side entry point: https://docs.npmjs.com/cli/v7/configuring-npm/package-json#browsermain
has to not useimport
and also provide the Node method, so I had to create a new build for thatCalling Babel a bunch of times from
package.json
feels a bit messy to me compared to having a single Rollup config that can output different builds. Rollup would also allow us to use@rollup/plugin-replace
instead ofsed
for removing the Node method. However, this is a bigger change, so didn't want to do that as part of this PR