Skip to content

Commit

Permalink
Update webpack 5 resolving (vercel#17095)
Browse files Browse the repository at this point in the history
On the latest beta of webpack 5 resolving fails with the below error and according to webpack/webpack#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.
```
  • Loading branch information
ijjk authored and Piotr Bosak committed Sep 26, 2020
1 parent b938334 commit c0b105c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/next/build/webpack-config.ts
Expand Up @@ -852,6 +852,18 @@ export default async function getBaseWebpackConfig(
},
module: {
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)$/,
include: [dir, ...babelIncludeRegexes],
Expand Down

0 comments on commit c0b105c

Please sign in to comment.