Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack 5 <> NextAuth - Can't resolve mongodb for webpack5 #25304

Closed
followbl opened this issue May 20, 2021 · 3 comments
Closed

Webpack 5 <> NextAuth - Can't resolve mongodb for webpack5 #25304

followbl opened this issue May 20, 2021 · 3 comments
Labels
bug Issue was opened via the bug report template.

Comments

@followbl
Copy link
Contributor

What version of Next.js are you using?

10.2.2

What version of Node.js are you using?

14.15.0

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

Vercel

Describe the Bug

When running yarn run build in the provided reproduction repo - I receive the error - ModuleNotFoundError: Module not found: Error: Can't resolve 'mongodb' - we do not have this issue with webpack4 where we are using the following conditional

    config.plugins.push(
      new options.webpack.IgnorePlugin({
        resourceRegExp: /^pg-native$/,
      })
    );

Expected Behavior

should build and work as it does locally. I logged this in that long thread that where y'all asked for anyone having trouble migrating from 4 => 5 and it must have gotten lost in the shuffle...reason I'm logging this again is we're running in to issues with other upgraded dependencies requiring webpack5.

To Reproduce

https://github.com/followbl/webpack5-next-auth

Pull down and run yarn run build

@followbl followbl added the bug Issue was opened via the bug report template. label May 20, 2021
@followbl
Copy link
Contributor Author

@timneutkens this was related to the target: serverless - I follow the nextjs release docs pretty closely and didn't know this wasn't a best practice anymore. Think this is a good idea here - would recommend.

#20790

@IgorDePaula
Copy link

This and another tricks not work for me =/

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants