Created
April 1, 2023 04:08
-
-
Save josezenem/09fb1b27cc20f55db4a27e0fd946dded to your computer and use it in GitHub Desktop.
Enable NextJS File Poll Watcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NEXT_WEBPACK_USEPOLLING=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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