Transpile the ESM bundle to ES5 but still use ES module system #181
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 #172 again.
See webpack/webpack#5756
The initial approach was to add a
browser
target to package.json andpoint it at the UMD build so that bundlers would pick that up instead of
the ESM build, since they (except for Rollup) tend to prefer
browser
first, then
module
(ESM), thenmain
.But that would potentially affect tree-shaking, and we don't want to
hamper that optimizing process.
So this PR transpiles the code in the ESM bundle down to ES5, so that
it runs in IE9+ like the CJS and UMD bundles do, while keeping the
import/export ESM statements.
Features and Bug Fixes
Test coverage added/updated.Typings added/updated.README updated (API changes, instructions, etc.).Changes to dependencies explained.yarn changeset
locally to add one, follow prompts).