This repository was archived by the owner on Jun 1, 2024. It is now read-only.
feat: add ES5 build using ES2015 modules #55
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 #52.
This PR provides bundles compatible with ES5 + ES2015 modules (instead of UMD / CommonJS).
This allows tools like Webpack to work without requiring a separate Babel-enabled compilation step or other expensive setup.
Unfortunately we cannot add ES5 as the default build indicated by the
module
entry inpackage.json
, therefore the default build remains the ES2015 build. This is because:The solution is to provide a separate ES5 build that can be used like this when doing a la carte dependency management:
Note that because of the way the TypeScript / JavaScript toolchain works, you may experience issues, because when doing testing with Mocha or Jest by means of say
ts-node
, the ES2015 imports end up using CommonJS under the hood (since they are running on top of Node) and thus don't expect ES2015 modules.Or you can see weird type mismatch errors, the compiler seeing the same type name imported from different places. An easy fix for this particular issue is to use the main
funfix
dependency, which includes everything in the UMD and ES5 bundles:All of this isn't the fault of Funfix, but of the way the JS tool-chain works. If you experience issues, drop on the Gitter channel to see what we can do.
Welcome to the hell that is JavaScript dependency management! This PR fixes one issue related to it. Probably more to come.