Open jaubourg opened 5 years ago
I was minifying a project with a package depending on
node-bindings
and the resulting code ended up throwing an exception regarding somepath
not being astring
.I pinpointed the problem in
getRoot
which led to the realization thatgetFileName
was returningundefined
. Finally, I spotted the culprit:dummy.stack
(https://github.com/TooTallNate/node-bindings/blob/master/bindings.js#L168).Most minifiers will remove code with no side effect, just like getting a property of an object while seemingly not having any use for it.
Since I use
uglify-es
, I'm able to set thepure_getters
compress option tofalse
, which instructs the minifier to be extra-conservative regarding object property accesses.I dunno if this is something you'd like to "fix" but I thought people should know in case they encounter the same issue.
thank you for this , this problem Trouble me whole week!
I was minifying a project with a package depending on
node-bindings
and the resulting code ended up throwing an exception regarding somepath
not being astring
.I pinpointed the problem in
getRoot
which led to the realization thatgetFileName
was returningundefined
. Finally, I spotted the culprit:dummy.stack
(https://github.com/TooTallNate/node-bindings/blob/master/bindings.js#L168).Most minifiers will remove code with no side effect, just like getting a property of an object while seemingly not having any use for it.
Since I use
uglify-es
, I'm able to set thepure_getters
compress option tofalse
, which instructs the minifier to be extra-conservative regarding object property accesses.I dunno if this is something you'd like to "fix" but I thought people should know in case they encounter the same issue.