browserify / bundle-collapser

convert bundle paths to IDs to save bytes in browserify bundles
Other
194 stars 21 forks source link

doesn't work with browserify@>5.4.2 #2

Closed guybrush closed 10 years ago

guybrush commented 10 years ago

the last version of browserify this module works correctly with is 5.4.2

i am not sure why, but i guess the internal ids changed from ids to absolute paths (i am not sure)

ghost commented 10 years ago

Seems to be fine for the usual case:

$ browserify yo.js | bundle-collapser 
(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<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
module.exports = function (n) { return n * 111 }

},{}],2:[function(require,module,exports){
var foo = require(1);
console.log(foo(5))

},{}]},{},[2]);
$ browserify yo.js | bundle-collapser | node
555
$ browserify -v
6.0.2
guybrush commented 10 years ago

i will try to investigate further - sorry if this is a false alarm!

i only use the api and with watchify. i will try to make a minimal test-case.

guybrush commented 10 years ago

got it :D

i set the fullPaths: true in the bundle-options, sorry this was a stupid mistake!

maybe we should note that fullPaths must be false (which is a no-brainer anyway :p)

thanks!