Adding ES Module Support with Backward Compatibility for AMD #87
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.
This PR adds support for ES Modules while ensuring backward compatibility with AMD modules.
rollup
is being used for the build process here. Details:rollup.config.js
generates the same set of files that were being generated bybuildpackage.js
earlier. It's modern and easy to use when it comes to supporting multiple modules. The only extra file that gets generated isSDK.js.map
which is actually helpful for debugging purposes. Please see the comments in the code file to understand the folder structure. Essentially, it adds AMD content to the package root (ensuring backward compatibility) and ESM content to anesm
folder. License, README.md, SECURITY.md and package.json files are added to the package root as well.tsconfig.amd.json
extends existingtsconfig.json
to support AMD modules.tsconfig.esm.json
extends existingtsconfig.json
to support ESM modules.Relevant issues addressed:
#66
#58
#56