browserify / factor-bundle

factor browser-pack bundles into common shared bundles
Other
402 stars 27 forks source link

The example doesn't work with latest version of browserify #44

Closed tleunen closed 6 years ago

tleunen commented 9 years ago

A user of grunt-browserify got an error using the plugins (see jmreidy/grunt-browserify#252), so I tried to investigate a bit but I'm not sure if it's an issue of factor-bundle or browserify, but the example doesn't work anymore.

Here is the exception thrown:

path.js:116
        throw new TypeError('Arguments to path.resolve must be strings');
        ^
TypeError: Arguments to path.resolve must be strings
    at Object.exports.resolve (path.js:116:15)
    at C:\test\node_modules\factor-bundle\index.js:59:26
    at Array.reduce (native)
    at Transform._flush (C:\test\node_modules\factor-bundle\index.js:49:35)
    at Transform.<anonymous> (C:\test\node_modules\factor-bundle\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:135:12)
    at Transform.g (events.js:180:16)
    at Transform.emit (events.js:117:20)
    at finishMaybe (C:\test\node_modules\factor-bundle\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:371:12)
    at endWritable (C:\test\node_modules\factor-bundle\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:378:3)
    at Transform.Writable.end (C:\test\node_modules\factor-bundle\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:356:5)

I tried to debug it and at this line, row doesn't have any file property:

{ entry: true,
  expose: false,
  basedir: undefined,
  id: 'C:\\test\\x.js',
  order: 0 }
{ entry: true,
  expose: false,
  basedir: undefined,
  id: 'C:\\test\\y.js',
  order: 1 }
yurynix commented 9 years ago

Had the same issue,

Added: .concat(b._options.entries) on line 24

Progromatic API doesn't have that issue btw, so you might just use that instead...

terinjokes commented 9 years ago

@tleunen I'm not sure which example you're referring to.

tleunen commented 9 years ago

This one

terinjokes commented 9 years ago

@tleunen what version of Browserify are you using? That example works (I just tried it manually here) and is part of the unit tests.

terinjokes commented 9 years ago

@tleunen Sorry, I see you're on Windows. The order is off on Windows, and I have a windowz branch attempting to resolve the issues going on there.

tleunen commented 9 years ago

Yes I was on windows for the test. I haven't tried with newer version of Browserify though... Good to know it's a known issue then ;)

ghost commented 9 years ago

A bunch of changes/fixes landed to the ordering system in browserify v7 and I just landed a patch in factor-bundle 2.3.3 that ignores files that don't have a row.file (because now transforms are also pushed through the module-deps input stream), but that might also fix the issue here.