gobblejs / gobble

The last build tool you'll ever need
333 stars 20 forks source link

Disabling source map flattening #93

Open Flaise opened 8 years ago

Flaise commented 8 years ago

In a project where I'm using Browserify to generate the client-side JS, the source map flattening step built into Gobble looks like it's taking up so much memory that it kills the entire VM.

Example output:

> gobble watch dist

(...etc)
gobble: 18-moveTo done in 17ms                                        
gobble: 45-merge done in 1ms                                          
∙∙∙∙∙∙∙ processing sourcemaps                                                  
<--- Last few GCs --->

   57975 ms: Mark-sweep 1289.3 (1456.6) -> 1289.2 (1456.6) MB, 337.7 / 0 ms [allocation failure] [GC in old space requested].
   58257 ms: Mark-sweep 1289.2 (1456.6) -> 1275.8 (1456.6) MB, 282.4 / 0 ms [allocation failure] [GC in old space requested].
   58652 ms: Mark-sweep 1289.2 (1456.6) -> 1289.2 (1456.6) MB, 341.4 / 0 ms [last resort gc].
   58938 ms: Mark-sweep 1289.2 (1456.6) -> 1275.8 (1456.6) MB, 285.6 / 0 ms [last resort gc].

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x1c34c9037339 <JS Object>
    1: parse [native json.js:~40] [pc=0x9c5dc9087c0] (this=0x1c34c9038151 <a JSON with map 0x3371f2410911>,r=0x36ae08c04101 <Very long string[931622]>,l=0x1c34c9004131 <undefined>)
    2: arguments adaptor frame: 1->2
    3: getMapFromUrl(aka getMapFromUrl) [gobble/dist/gobble.js:~804] [pc=0x9c5dc9d1a30] (this=0x1c34c9004131 <undefined>,url=0x16fcbb981c09 <Very long string...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Aborted (core dumped)

I can turn off Browserify's source maps and that makes this problem stop happening but that introduces another problem where the debugger only shows me the bundled file instead of the files that created the bundle. Alternatively, I can comment out Gobble's source map flattening step and that leaves me with a source map that makes the debugger display each file individually. It doesn't show me source code but rather the generated code (this may be because one of my build steps doesn't support source maps at all but I haven't isolated the issue yet) but because it's broken up into files, it's manageable so an option to turn off Gobble's source map flattening step would be nice.

timshannon commented 8 years ago

Same here. In some simpler projects I just want to copy some static, already built content. The gobble sourcemaps piece runs out of memory every time.