glimmerjs / glimmer-resolver

MIT License
7 stars 4 forks source link

Cannot build in Node >= 8.3.0 #19

Open mixonic opened 6 years ago

mixonic commented 6 years ago

In Node 8.2.1 I can build the resolve, in 8.3.0 and greater I get a failure ala:

screen shot 2017-10-05 at 9 56 47 pm

I spent some time debugging this and it seams the return value from getFileName here is sometimes null. I tried to add a reproduction test on https://github.com/glimmerjs/glimmer-build but failed.

Refs: https://github.com/glimmerjs/glimmer-build/issues/49

mansona commented 6 years ago

So I spent a bit of time looking into this and the reason why the stackFrame.getFileName() is null is because that stack frame is actually an anonymous Array.map() so theoretically it doesn't have a file name 😕

I don't know what the desired behaviour is but maybe we should continue looping through the stack until we come across a file? Again I'm not entirely sure what the use case is.

This is the first few lines of the stack at that point:

pathToCaller (/Users/mansona/git/stonecircle/opensource/ember/glimmer-resolver/node_modules/@glimmer/build/lib/resolve-package.js:17:35)
module.exports (/Users/mansona/git/stonecircle/opensource/ember/glimmer-resolver/node_modules/@glimmer/build/lib/resolve-package.js:9:20)
module.exports (/Users/mansona/git/stonecircle/opensource/ember/glimmer-resolver/node_modules/@glimmer/build/lib/package-dist.js:12:30)
Array.map (<anonymous>)
module.exports (/Users/mansona/git/stonecircle/opensource/ember/glimmer-resolver/node_modules/@glimmer/build/index.js:60:53)
Object.<anonymous> (/Users/mansona/git/stonecircle/opensource/ember/glimmer-resolver/Brocfile.js:5:18)
Module._compile (module.js:573:30)
Object.Module._extensions..js (module.js:584:10)

I'm assuming the desired stack line would be: Object.<anonymous> (/Users/mansona/git/stonecircle/opensource/ember/glimmer-resolver/Brocfile.js:5:18)?

mansona commented 6 years ago

btw this test passes if I manually change the index here https://github.com/glimmerjs/glimmer-build/blob/master/lib/resolve-package.js#L15 to 5, which would point at the stack item: Object.<anonymous> (/Users/mansona/git/stonecircle/opensource/ember/glimmer-resolver/Brocfile.js:5:18)