Code Monkey home page Code Monkey logo

bundle-buddy's Introduction

Bundle Buddy

Bundle Buddy is a tool to help you find source code duplication across your javascript chunks/splits. This enables you to fine tune code splitting parameters to reduce bundle invalidation rates as well as improve repeat page load performance \o/.

Example Bundle Buddy UI

Bundle Buddy operates on any source maps, but you must include the source content. It will work for any CSS/JS/TEMPLATES etc. that is mapped.

In webpack this means setting devtool to source-map https://webpack.js.org/guides/development/#source-maps

webpack users

If you are using webpack, you can also try the bundle-buddy-webpack-plugin. This helps ensure you configure your sourcemaps correctly, and lets you run bundle-buddy directly from a webpack build. You might want to use this if you don't want to use bundle buddy standalone!


How to use?

npm install -g bundle-buddy

bundle-buddy my-app/public/*.map

Bundle Buddy UI interactions.

When you select a bundle on the left panel, you can then see the bundle breakdown, which shows you the most duplicated source lines across bundles that the currently selected bundle contains.

After clicking on a bundle chunk we will then show you the lines of the source file that are repeated as well as what other bundles contain said source lines.

Acting on the results.

The ideal workflow flow using Bundle Buddy is to first identify what code is most duplicated across the project's bundles, then to utilize a common code bundling techique (https://webpack.js.org/plugins/commons-chunk-plugin/), then to rebuild your site, and then finally to measure again to see your impact.

How does this work?

Bundle Buddy builds up a mapping across every source map of every file and each line in each file that is used. This enables Bundle Buddy to detect common source lines between different project chunks.


Contributing

Working on the front end is simple

cd viz
yarn install
yarn start

Working on the CLI component is also straight forward

yarn install
./node_modules/.bin/ts-node index.ts

bundle-buddy's People

Contributors

jimthedev avatar ndelangen avatar paulirish avatar piperchester avatar samccone avatar sudo-suhas avatar susielu avatar tbuchanan avatar thelarkinn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.