Closed wonderlic-stephene closed 9 years ago
This may require the same fix as this commit:
// esprima@2.1 introduces a "handler" property on TryStatement, so we would
// loop the same node twice (see jquery/esprima/issues/1031 and #264)
rocambole.BYPASS_RECURSION.handler = true;
I recently cleaned my node_modules directory and re-ran npm install and started getting an out of memory error that I have traced back to this plugin (and its dependencies).
Take a look at the following simplified example that can reproduce this:
Version 1.0.1 processes this correctly, but the latest version 1.1.0 eats up tons of memory and eventually spits out an error:
FATAL ERROR: JS Allocation failed - process out of memory
It appears that since the last time I cleared my node_modules directory and re-installed npm packages, some of the dependent packages have changed versions. The one that appears to impact this is the esprima package that is included through the strip-debug -> rocambole -> esprima dependency path. Currently npm provides esprima@2.1.0. If I manually downgrade that to 1.2.5 the above code works fine. If I run the above example file through the esprima online validator, it validates ok. So, I don't think the issue is with esprima directly. It is probably something higher up the chain is expecting something different than esprima now provides.
I have no good way of locking in the version of esprima or even this library. I am using this through your gulp-strip-debug library that uses ^1.0.0 (i.e. the latest 1.x.x or currently 1.1.0) instead of ~1.0.0 (i.e. 1.0.x or currently 1.0.1). Because 1.1.0 of this library introduced a breaking change, the gulp-strip-debug should probably be more explicit about which version it pulls in.