brunch / deppack

Extract node modules to browser.
MIT License
4 stars 13 forks source link

Moved code variable #42

Closed nblackburn closed 7 years ago

nblackburn commented 7 years ago

Halfway there but you forgot about the code variable not being defined.

shvaikalesh commented 7 years ago

It was in scope (note var there). With this change, we set code to DEPS_RESOLVE_FAILED on any error (for example, SyntaxError in module), not just when resolve actually failed.

nblackburn commented 7 years ago

@shvaikalesh It's not in scope unless data is true which it wasn't in my particular edge case so i moved it outside so it's always available, fixing the error.

shvaikalesh commented 7 years ago

@nblackburn vars are function-scoped, so if data was falsy error.code = undefined would happen, without any error.

nblackburn commented 7 years ago

@shvaikalesh Except it throws an error so i fixed it.

shvaikalesh commented 7 years ago

@nblackburn there is no possible way it can throw per spec. I believe you've got an error before this commit: https://github.com/brunch/deppack/commit/399f0f8f419ea8955787d87043fabf6eb7bfaecd

nblackburn commented 7 years ago

@shvaikalesh Yes, that is correct. Never even saw this commit but now it makes sense.