gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.21k stars 10.33k forks source link

Process not exiting after running `gatsby build` #953

Closed Tom-Bonnike closed 7 years ago

Tom-Bonnike commented 7 years ago

I tried cloning gatsby-starter-default and it works properly, so IDK what could be wrong with my project. This is obviously annoying for tasks such as: gatsby build --prefix-links && gh-pages -d public I simply fixed it by adding process.exit() in cli.js when the command is done, but it’s still strange! Here’s the code if you want to take a look: https://github.com/Tom-Bonnike/portfolio-amine

EDIT: this twitter thread is interesting, I’ll investigate on my own project when I’ll have the time :) https://twitter.com/kentcdodds/status/863070381648859136

Tom-Bonnike commented 7 years ago

Oh, I found the culprit. A setTimeout in GSAP’s TweenLite. I’ll see what I can do on their side :) If someone ever has the same problem, here’s how I debugged it: I removed every page, one by one, until I was only left with my _template.js only rendering a <div> and my JSON wrapper. I was actually rendering a component in this wrapper. I made it so that the component would only render a <div> and then commented out every dependency one by one until I found out it was TweenLite. As suggested on the twitter thread that I linked, I used https://github.com/mafintosh/why-is-node-running to see what was making node hang in TweenLite :)

I can still open a PR to add that sweet process.exit() if you’d like!