ember-cli / ember-cli-babili

BSD 2-Clause "Simplified" License
4 stars 5 forks source link

Build goes into an infinite loop #7

Closed boris-petrov closed 7 years ago

boris-petrov commented 7 years ago

First I had the same issue as this one: https://github.com/ember-cli/ember-cli-babili/issues/6. Now it is fixed but now no matter what I do ember build freezes, takes 100% CPU and doesn't seem to finish. I waited for at least 10 minutes (a normal build with uglify-js takes less than a minute). It doesn't respond to CTRL+C and cannot kill it with killall ember - I have to use killall -9 ember.

The same happens no matter what config/targets.js I use - i.e. whether I add ie 9 to browsers or not (which means that ember-cli-babili goes into the infinite loop even on ES5 syntax).

How do I debug to help you figure it out?

rwjblue commented 7 years ago

Yikes! That seems bad.

I guess the thing I would do is try to trace what is actually happening while the build is frozen. Perhaps by running with node --inspect --debug-brk $(which ember) b -prod and pausing (in the sources tab).

boris-petrov commented 7 years ago

Ok, from what I see while debugging, vendor.js is being parsed for a very long time. Every time I pause, multiple "visit" calls are in the stack.

I tried removing everything we import as 3rd party libraries from ember-cli-build.js and then it built fine. Then I started returning stuff incrementally and it seems to be working (although it takes many minutes for only small parts of our original ember-cli-build.js). So it's probably just horribly slow. Or there's some file that we import that breaks it in the middle. I'll try to leave it during the night with everything included and will see how long it takes if it even finishes. I'll ping you tomorrow with the results.

Thanks!

rwjblue commented 7 years ago

Thank you!

boris-petrov commented 7 years ago

So, the full build took a little bit over 25 minutes. :) For a file this big:

dist/assets/vendor-4fec1b2cac61e9e7b886d23da3a5326f.js: 3.48 MB (914.62 KB gzipped)

We have many other JS and CSS files that are minified/fingerprinted but this is by far the biggest one. In any case, the same process with uglify-js takes about a minute... Any ideas what we might do? I guess wait for uglify to support ES6... in the next couple of years? :)

rwjblue commented 7 years ago

Yeah, I guess our options are to either try to make Babili faster or make uglify support ES6. There are efforts underway for both of these, but I honestly have no clue which will happen first.

boris-petrov commented 7 years ago

I see. Ok, thanks, sorry for the confusion! Closing this now.