I'm using neutrino node.js preset with hot module replacement enabled, here's what I have in index.js
:
import fastify from 'fastify'
import router from './router'
const ft = fastify()
ft.register(router)
// enable hot module replacement
if (module.hot) {
module.hot.accept()
}
// listen
ft.listen(3000, 'localhost', (err) => {
if (err) throw err
console.log(`server listening on ${ft.server.address().port}`)
})
When I edit a file, I would got this:
I'm wondering if it is possible to use hot module replacement like this? Anyone have experience?
Thank you.