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
- Host: GitHub
- URL: https://github.com/browserify/bundle-collapser
- Owner: browserify
- License: other
- Created: 2014-07-25T02:02:54.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-03-09T14:57:30.000Z (almost 5 years ago)
- Last Synced: 2024-05-15T13:09:19.367Z (over 1 year ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 194
- Watchers: 7
- Forks: 21
- Open Issues: 10
-
Metadata Files:
- Readme: readme.markdown
- License: LICENSE
Awesome Lists containing this project
README
# bundle-collapser
convert bundle paths to IDs to save bytes in browserify bundles
[](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