Skip to content

Instantly share code, notes, and snippets.

@josezenem
Created April 1, 2023 04:08
Embed
What would you like to do?
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