@timneutkens @Timer I'm using Yarn 2 and I have a Next.js application within a monorepo alongside some other Webpack 5 applications. I have set the resolutions at the root package.json level to resolve to Webpack 5. What I've found is that by doing that, it actually breaks my jsconfig.json and absolute imports. This is a continuation of this comment.
@sokra Should be fixed as of 5.0.0-beta.24
I've updated to [email protected] and [email protected] and the error is still present. I've updated my reproduction repo to reflect it. This is the error I see in the terminal:
Module not found: Your application tried to access components, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Required package: components (via "components/Header")
Required by: /broken-jsconfig/packages/next-app/pages/
3 | * This import throws an error when using webpack 5 resolution in monorepo
4 | */
> 5 | import Header from 'components/Header';
6 | import styles from '../styles/Home.module.css'
7 |
8 | export default function Home() {
Oh my fault. I was talking about this issue: https://github.com/vercel/next.js/issues/13341#issuecomment-667775599 with the jsconfig.
The issue you run into is something different and I think that's some kind of next plugin that validates that.
Oh my fault. I was talking about this issue: #13341 (comment) with the jsconfig.
The issue you run into is something different and I think that's some kind of next plugin that validates that.
No worries.
Thanks for opening this! We'll take a look soon.
The same happens for tsconfig.json paths and yarn v2, the yarn resolution process thinks that the typescript paths aliases should be dependencies and throws Module not found: Your application tried to access ...
Edit:
I haven't install webpack 5, i am just using 9.5.3 @canary
Most helpful comment
Thanks for opening this! We'll take a look soon.