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

Update webpack 5 resolving (#17095)

On the latest beta of webpack 5 resolving fails with the below error and according to https://github.com/webpack/webpack/issues/11467 is due to the imports in this module not being fully specified. This adds the config mentioned in the thread to correct the resolving for this module. 

```sh
Failed to compile.
--
16:33:50.046 | ModuleNotFoundError: Module not found: Error: Can't resolve './assertThisInitialized' in '/vercel/f03cc85/node_modules/@babel/runtime/helpers/esm'
16:33:50.046 | > Build error occurred
16:33:50.047 | Error: > Build failed because of webpack errors
16:33:50.047 | at build (/vercel/f03cc85/node_modules/next/dist/build/index.js:15:918)
16:33:50.099 | error Command failed with exit code 1.
```
 
parent 0c1ebb4d
...@@ -852,6 +852,18 @@ export default async function getBaseWebpackConfig( ...@@ -852,6 +852,18 @@ export default async function getBaseWebpackConfig(
}, },
module: { module: {
rules: [ rules: [
...(isWebpack5
? [
// TODO: FIXME: do NOT webpack 5 support with this
// x-ref: https://github.com/webpack/webpack/issues/11467
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
} as any,
]
: []),
{ {
test: /\.(tsx|ts|js|mjs|jsx)$/, test: /\.(tsx|ts|js|mjs|jsx)$/,
include: [dir, ...babelIncludeRegexes], include: [dir, ...babelIncludeRegexes],
......
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