Skip to content

A command-line interface to see how adding packages affects your React Native JavaScript bundle.

License

Notifications You must be signed in to change notification settings

charpeni/react-native-bundle-scale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library's logo

React Native Bundle Scale

A command-line interface to see how adding packages affects your React Native JavaScript bundle.

Current npm package version. Monthly downloads Current CircleCI build status. PRs welcome! React Native Bundle Scale is released under the MIT license.


Library's example

Usage

You can use this CLI to either get the cost of adding packages to a freshly initialized React Native project or based on a package.json:

# To get the cost of adding `react-native-url-polyfill` to a freshly initialized React Native project
npx react-native-bundle-scale react-native-url-polyfill

# To get the cost of adding `react-native-url-polyfill` based on the current `package.json`
npx react-native-bundle-scale react-native-url-polyfill --package-json

The CLI will initialize a new React Native project either untouched or with the dependencies from the package.json you provided. It will generate a bundle for the original state, add the packages you provided, generate another bundle, and finally, diff both bundle sizes.

What's the difference between this and Bundlephobia and co?

Don't get me wrong, Bundlephobia and co. are amazing tools. They will analyze a dependency and its transitive dependencies and will try to determine the cost associated with adding it.

Unfortunately, they aren't always accurate for React Native bundles. They are multiple reasons for that, but the main reasons are that React Native bundles all share the same initial dependencies, so it depends on what React Native packages by default, but it also depends on your current dependencies and their versions.

In this CLI case, it creates a React Native bundle with the provided packages and then diffs the size of both packages (with/without).

License

react-native-bundle-scale is MIT licensed.

About

A command-line interface to see how adding packages affects your React Native JavaScript bundle.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published