improve Babel and webpack configurations --> reduce JS bundle size #670
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 contains several important changes regarding current build tooling, that coupled together, and allowed to decrease resulting JS bundle size to 19.35 Kb from current 22.11 Kb 🎉
Details below:
Babel: Removing dependency on separated plugins, included in
preset-env
and updating the rest to the latest versions. This required fixes inwrapped-element
andwrapped-input
classes, related to property definition (getter and setter must be defined/inherited in the same time).webpack: you are using two, mostly identical configs -
webpack.config.dev
andwebpack.config.prod
. To avoid code duplication and taking advantage that we already havedeepmerge
dependency, I've separated common part of configs intowebpack.config.common
and reuse it. For production version you were using plugin to build minified and non-minified version, I've removed that in favor of documented way - returning array of configs. Also addedlibraryExport: 'default'
here that allowed to use normalexport default Choices
inchoices.js
(the VSCode Typescript notice regarding lack of default export in this file was my major motivation for this whole refactoring). Upgraded all touched dependencies here to the latest versions.Cypress: added
jsconfig.json
file to teach VSCode do IntelliSence for Cypress in spec files and stealed one fix for failing test from your earlier attempt ;-)Upgraded
redux
anddeepmerge
to current versions chasing bundle size minimisingWhile I don't see how anything here may be a breaking change, I would suggest to release as minor version just in case (mostly due to Choices default export fix)
BONUS: Fixed
lint.yml
action to run ESLint only on affectedsrc/scripts/**/*.js