Build the library bundle from a src folder using rollup and other refactorings#19
Open
elchininet wants to merge 1 commit intoAoDev:masterfrom
Open
Build the library bundle from a src folder using rollup and other refactorings#19elchininet wants to merge 1 commit intoAoDev:masterfrom
elchininet wants to merge 1 commit intoAoDev:masterfrom
Conversation
86b1fbb to
6de504b
Compare
Owner
|
@elchininet Wow it's a big change, complete rewrite. I'll need some time to look at it. |
Contributor
Author
|
Hi @AoDev, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
const { ^ SyntaxError: Unexpected token { ...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.
rollupopens the door for creating other distribution versions of the package if they are needed (like an ESM version) and@rollup/plugin-typescriptallows 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:
libfolder (CHANGELOG, README, LICENSE, and package.json are included by default)lint:fixscript has been created to fix all the prettier issuesObject.valuespolyfill)