hughsk / disc

:chart_with_upwards_trend: Visualise the module tree of browserify project bundles and track down bloat.
http://hughsk.io/disc
Other
1.33k stars 83 forks source link

-r seems to break it? #20

Open mattdesl opened 10 years ago

mattdesl commented 10 years ago

With -r ./foo/bar:foo option to browserify, I'm getting this error:

/usr/local/lib/node_modules/disc/bin/discify:59
    if (err) throw err
                   ^
Error: Unable to compile one of the supplied bundles!
    at /usr/local/lib/node_modules/disc/index.js:47:56
    at Array.map (native)
    at json (/usr/local/lib/node_modules/disc/index.js:46:5)
    at Function.bundle (/usr/local/lib/node_modules/disc/index.js:128:10)
    at handle (/usr/local/lib/node_modules/disc/bin/discify:56:8)
    at BufferList.disc.bundle.mode [as _callback] (/usr/local/lib/node_modules/disc/bin/discify:45:5)
    at BufferList.end (/usr/local/lib/node_modules/disc/node_modules/bl/bl.js:75:10)
    at Socket.onend (stream.js:79:10)
    at Socket.emit (events.js:117:20)
    at _stream_readable.js:929:16

Will try to look into it further..

EDIT: Seems related to browser-unpack; the latest version 1.0.0 fixes the problem but introduces another:

/projects/disc/node_modules/commondir/index.js:15
            throw new Error('relative path without a basedir');
                  ^
Error: relative path without a basedir
    at /projects/disc/node_modules/commondir/index.js:15:19
    at Array.reduce (native)
    at module.exports (/projects/disc/node_modules/commondir/index.js:13:30)
    at json (/projects/disc/index.js:70:14)
    at Function.bundle (/projects/disc/index.js:128:10)
    at handle (/projects/disc/bin/discify:56:8)
    at BufferList.disc.bundle.mode [as _callback] (/projects/disc/bin/discify:45:5)
    at BufferList.end (/projects/disc/node_modules/bl/bl.js:75:10)
    at Socket.onend (stream.js:79:10)
    at Socket.emit (events.js:117:20)

Using a full path for my -r option doesn't fix the issue.

hughsk commented 10 years ago

Interesting - I recognise both these errors, will look into it shortly and let you know :)

mattdesl commented 10 years ago

cool.. no rush, i hacked a fix by ignoring the problematic modules

hughsk commented 10 years ago

Cool – do you have a test case I can break it with?

mattdesl commented 10 years ago

Unfortunately the code is private. I'll see if I can replicate it tho

Sent from my iPhone

On Aug 15, 2014, at 4:18 PM, Hugh Kennedy notifications@github.com wrote:

Cool – do you have a test case I can break it with?

— Reply to this email directly or view it on GitHub.

jkimbo commented 10 years ago

Getting the same error unfortunately. @mattdesl did you get around to reproducing the problem?

mattdesl commented 10 years ago

I was able to reproduce it on a private repo. Basically this was breaking it:

browserify -r app/foo:foo

Where "foo" was a module that had its own package and index.js.

If I remember correctly, I lazily fixed it by doing npm link app/foo which symlinked it into the node_modules dir. Once the module could be required without the -r option, it seemed to work.

Sent from my iPhone

On Oct 13, 2014, at 6:21 PM, Jonathan Kim notifications@github.com wrote:

Getting the same error unfortunately. @mattdesl did you get around to reproducing the problem?

— Reply to this email directly or view it on GitHub.

nnarhinen commented 10 years ago

this also seems to happen if you have custom NODE_PATH like NODE_PATH=$NODE_PATH:lib/ and in your app you require like require('ding/dong') where dong.js is in lib/ding/dong.js

jackwanders commented 9 years ago

Thought I'd add that this appears to continue to be an issue. I get the same error when creating a 'vendor' bundle that consists solely of --require'd modules, e.g.

$ browserify -r foo -r bar -r baz --full-paths > vendor.js
joews commented 9 years ago

I'm getting the same issue with --require -only bundles.

domarmstrong commented 9 years ago

+1 cant compile with --require

SystemParadox commented 9 years ago

See also #41. Should be fixed by #45.