Build the library bundle from a src folder using rollup and other refactorings #19
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.
The library works well in newer Node versions but we noticed that it was failing in a legacy project that is hard to upgrade with this message:
This is due to old Node versions don‘t support the destructuring assignments located in the main file.
Instead of trying to modify the code to support old Node versions, it is better to write modern JavaScript code in a source folder and compile it using ES5 to a distribution folder (which makes the library ready to work with Node 4). So, it is possible to use any ESNext code as:
Without any fear that the code could fail because of compatibility issues.
To make this possible a tandem of rollup and @rollup/plugin-typescript has been used.
rollup
opens the door for creating other distribution versions of the package if they are needed (like an ESM version) and@rollup/plugin-typescript
allows writing the code in TypeScript if it is wanted in the future, its function, for now, is just to transpile any modern JavaScript code into ES5 standard code.As part of this pull-request other changes have been made:
lib
folder (CHANGELOG, README, LICENSE, and package.json are included by default)lint:fix
script has been created to fix all the prettier issuesObject.values
polyfill)