Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List modules bundled by Browserify

I am using Browserify and Grunt to bundle our RendrJS webapp. I would like to analyze the bundle to see which modules it contains to see if any code is superfluous. This can happen since in Rendr some js code might only run on the server.

How do I get a list of the contents of the bundle. I have tried:

browserifyOptions: { 'list': true }

but it doesn't seem to have any effect. We are using Browserify 2.

like image 382
Skanaar Avatar asked May 07 '15 14:05

Skanaar


People also ask

How do I use browserify bundles?

Use a node-style require() to organize your browser code and load modules installed by npm. browserify will recursively analyze all the require() calls in your app in order to build a bundle you can serve up to the browser in a single <script> tag.

Is browserify a module loader?

Consequently, Browserify isn't as much a module loader as a module bundler: Browserify is entirely a build-time tool, producing a bundle of code which can then be loaded client-side.

What are some of the benefits of browserify?

Browserify makes it possible to use node modules directly in the browser. It integrates well with npm and allows you to bundle your JavaScript dependencies into one file that can be referenced within a <script> tag.

Is browserify a bundler?

Browserify is an open-source JavaScript bundler tool that allows developers to write and use Node. js-style modules that compile for use in the browser.


1 Answers

Saw your question, dug up a tiny old script and just now pushed browserify-inspect-bundle to npm, grab it here:

https://www.npmjs.com/package/browserify-inspect-bundle

Usage is:

npm install -g browserify-inspect-bundle
browserify-inspect-bundle /path/to/your/bundle.js

This should get you something useful.

like image 73
maligree Avatar answered Nov 11 '22 03:11

maligree