Unverified Commit c93c9fcc authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Add error for invalid webpack 5 version (#20558)

Closes: https://github.com/vercel/next.js/issues/20545
parent 69ff6499
# Invalid webpack 5 version
#### Why This Error Occurred
While leveraging webpack 5 support in Next.js the minimum required version of `v5.11.1` was not met. This version is needed while leveraging webpack 5 support with Next.js as early versions are missing patches that cause unexpected behavior.
#### Possible Ways to Fix It
Upgrade the version of webpack 5 being used with Next.js to at least `v5.11.1` by updating your resolutions field for `webpack` in your `package.json`.
### Useful Links
- [Yarn Selective Dependency Resolutions Documentation](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/)
...@@ -64,6 +64,12 @@ type ExcludesFalse = <T>(x: T | false) => x is T ...@@ -64,6 +64,12 @@ type ExcludesFalse = <T>(x: T | false) => x is T
const isWebpack5 = parseInt(webpack.version!) === 5 const isWebpack5 = parseInt(webpack.version!) === 5
if (isWebpack5 && semver.lt(webpack.version!, '5.11.1')) {
throw new Error(
`webpack 5 version must be greater than v5.11.1 to work properly with Next.js, please upgrade to continue!\nSee more info here: https://err.sh/next.js/invalid-webpack-5-version`
)
}
const devtoolRevertWarning = execOnce((devtool: Configuration['devtool']) => { const devtoolRevertWarning = execOnce((devtool: Configuration['devtool']) => {
console.warn( console.warn(
chalk.yellow.bold('Warning: ') + chalk.yellow.bold('Warning: ') +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment