Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve Babel and webpack configurations --> reduce JS bundle size #670

Merged
merged 8 commits into from
Oct 22, 2019
Merged

improve Babel and webpack configurations --> reduce JS bundle size #670

merged 8 commits into from
Oct 22, 2019

Conversation

tinovyatkin
Copy link
Contributor

@tinovyatkin tinovyatkin commented Oct 22, 2019

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:

  1. Babel: Removing dependency on separated plugins, included in preset-env and updating the rest to the latest versions. This required fixes in wrapped-element and wrapped-input classes, related to property definition (getter and setter must be defined/inherited in the same time).

  2. webpack: you are using two, mostly identical configs - webpack.config.dev and webpack.config.prod. To avoid code duplication and taking advantage that we already have deepmerge dependency, I've separated common part of configs into webpack.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 added libraryExport: 'default' here that allowed to use normal export default Choices in choices.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.

  3. 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 ;-)

  4. Upgraded redux and deepmerge to current versions chasing bundle size minimising

While 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 affected src/scripts/**/*.js

@tinovyatkin
Copy link
Contributor Author

@jshjohnson Looks good?

Copy link
Collaborator

@jshjohnson jshjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 🎉

@jshjohnson jshjohnson merged commit 6848970 into Choices-js:master Oct 22, 2019
@tinovyatkin tinovyatkin deleted the webpack-4-way branch October 22, 2019 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants