Skip to content

Instantly share code, notes, and snippets.

@josezenem
Created April 1, 2023 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josezenem/09fb1b27cc20f55db4a27e0fd946dded to your computer and use it in GitHub Desktop.
Save josezenem/09fb1b27cc20f55db4a27e0fd946dded to your computer and use it in GitHub Desktop.
Enable NextJS File Poll Watcher
NEXT_WEBPACK_USEPOLLING=1
// Source: https://medium.com/mikkotikkanen/solving-next-js-fast-refresh-on-docker-windows-71dfdb3ee785
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
webpack: (config, context) => {
// Enable polling based on env variable being set
if(process.env.NEXT_WEBPACK_USEPOLLING) {
config.watchOptions = {
poll: 500,
aggregateTimeout: 300
}
}
return config
},
}
module.exports = nextConfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment