Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CLI breaking on nodes wihtout deps #3

Merged
merged 1 commit into from
Jun 12, 2017
Merged

Fix CLI breaking on nodes wihtout deps #3

merged 1 commit into from
Jun 12, 2017

Conversation

stefanmaric
Copy link
Contributor

browserify-breakdown < _dist/js/index.min.js
/home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:40
    var nodes = node.deps.map(function(node) {
                         ^

TypeError: Cannot read property 'map' of undefined
    at prepareForArchyInput (/home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:40:26)
    at /home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:41:14
    at Array.map (native)
    at prepareForArchyInput (/home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:40:27)
    at /home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:41:14
    at Array.map (native)
    at prepareForArchyInput (/home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:40:27)
    at /home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:41:14
    at Array.map (native)
    at prepareForArchyInput (/home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:40:27)

```
browserify-breakdown < _dist/js/index.min.js
/home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:40
    var nodes = node.deps.map(function(node) {
                         ^

TypeError: Cannot read property 'map' of undefined
    at prepareForArchyInput (/home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:40:26)
    at /home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:41:14
    at Array.map (native)
    at prepareForArchyInput (/home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:40:27)
    at /home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:41:14
    at Array.map (native)
    at prepareForArchyInput (/home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:40:27)
    at /home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:41:14
    at Array.map (native)
    at prepareForArchyInput (/home/sam/n/lib/node_modules/browserify-breakdown/bin/cmd.js:40:27)

```
@coveralls
Copy link

coveralls commented Jun 10, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling b58ae21 on stefanmaric:master into c8e6e2b on seangenabe:master.

@seangenabe seangenabe merged commit dd4dbee into seangenabe:master Jun 12, 2017
@seangenabe
Copy link
Owner

I've merged your PR, but I'm also interested to know what specific module causes this so I can investigate and write some tests for it.

@stefanmaric
Copy link
Contributor Author

@seangenabe I spent some good time debugging the app and finally found out what produces this error: it is the inserGlobals option of browserify.

You can replicate:

mkdir test
cd test
npm install browserify browserify-breakdown@1.0.2
echo 'console.log("test")' > entry.js
# this one succeeds
./node_modules/.bin/browserify entry.js | ./node_modules/.bin/browserify-breakdown
# this one fails
./node_modules/.bin/browserify entry.js --insert-globals | ./node_modules/.bin/browserify-breakdown

I tested with node@6.11.0 and npm@3.10.10 this time, but I've seen this happen with a wide range of versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants