An open API service indexing awesome lists of open source software.

https://github.com/browserify/bundle-collapser

convert bundle paths to IDs to save bytes in browserify bundles
https://github.com/browserify/bundle-collapser

Last synced: 10 months ago
JSON representation

convert bundle paths to IDs to save bytes in browserify bundles

Awesome Lists containing this project

README

          

# bundle-collapser

convert bundle paths to IDs to save bytes in browserify bundles

[![build status](https://secure.travis-ci.org/browserify/bundle-collapser.png)](http://travis-ci.org/browserify/bundle-collapser)

# example

The easiest way to use bundle-collapser is from the plugin:

```
$ browserify -p bundle-collapser/plugin main.js
```

Instead of the usual output which would have the original `require('./foo.js')`
style calls in it, the output just has `require(2)` style paths, which minifies
more compactly:

``` js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o