Gatsby: Nice to have: hot reload / restart server when gatsby-node.js updated

Created on 3 Jan 2019  路  7Comments  路  Source: gatsbyjs/gatsby

Summary

Would be a nice-to-have productivity boost with hot reloading when gatsby-node.js is updated.

Motivation

Gatsby detects a lot of changes and hot reloads, so it would make sense to restart the server when doing common things like adding new node fields.

stale?

Most helpful comment

All 7 comments

This is actually pretty tricky to do since gatsby-node.js does a lot more than creating pages. As a result, it's difficult to localise the hot reloading behaviour to _just_ node fields or adding pages.

Related discussion at https://github.com/gatsbyjs/gatsby/issues/8163

I'd be happy with a complete teardown of the server and restart if state can get corrupted.

I believe any change to gatsby-node.js will always require a restart for it to take effect .

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.

Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

This would be pretty nice indeed. Anyone found a good setup?

Hey folks, I've just quickly put together a plugin to restart Gatsby's process automatically when gatsby-* file changes: https://github.com/d4rekanguok/gatsby-plugin-node-reload

It watches your gatsby-* files (chokidar), spawn a new detached child process on change, kill the previous one while using the same stdout. The caveat is that when you want to end this process you'd have to do it manually (kill -15 {PID} on macOS). The plugin will log out the current PID at the beginning of each process.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikestopcontinues picture mikestopcontinues  路  3Comments

benstr picture benstr  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments

jimfilippou picture jimfilippou  路  3Comments

kalinchernev picture kalinchernev  路  3Comments