-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Module not found: Can't resolve <name> #988
Comments
Could you please add a reproduction repo with a link to debug this? |
Some observations:
p.s: edit: |
When it's merged, I would appreciate feedback either here (encourage you to tag me) on the PR, or in a new issue/discussion. I really hope that #1682 will be as impactful as I think it will be. |
@balazsorban44 I used the latest
|
yes, it unfortunately needs more tinkering. I have ideas, but I don't have an ETA. You can just follow the |
Sure, thank you. |
Okay. So due to my OCD, I landed on typeorm's docs: https://github.com/typeorm/typeorm/blob/master/docs/faq.md#how-to-use-webpack-for-the-backend |
Is this something we should point users to when they have this issue? To be honest, I think I used the TypeORM adapter only once locally to test something with the Email provider (with Postgres), and I don't remember seeing these warnings. Do you maybe have a reproduction (with the current |
Hey @balazsorban44 But, hey, I successfully reproduced the bug. Phew! It's due to next.config.js. I added next-images module just to showcase that I need to have custom config via min repo: https://github.com/s-kris/test-next-auth-custom-server-typescript |
I had the same issue and found this thread. Using And after a lot of research and a lot of failures I ended up making it work like this: dependencies in
and at the very top of
That allowed me to use next/auth in JWT mode (just using the Google Provider) imported as: Odd that it only works with core-js@2 and not with the new core-js@3 versions. But that might be an issue with another dependency. I hope this helps! Edit: API routes need the imports as well, as they are standalone functions. |
Be aware that the I intend to work out how to exclude TypeORM from default bundles with the least amount of break, and I also would like to modernize our bundle output, as (in theory) the lowest version of Node that we should aim for is Node 12. Next.js supports 10.13, but I don't think there is any point for us to go lower than that. Upgrading out babel output will greatly impact the bundle size and probably performance as well, as much less boilerplate will be needed, since Node12 and up supports async out of the box! |
Did you able to build it? |
EDIT: Looks like you can no longer target Seeing similar issues when trying to build locally or in CI:
It looks like without explicit dependency of all the modules @s-kris listed the build will fail — but I've been installing packages for quite some time without any change. It feels like maybe recursive dependencies aren't being pulled, and likely don't need to be pulled, but when webpack hits TypeORM, it thinks it needs them. Tried falling back to Webpack 4, but no change. Also tried disconnecting my DB from next auth, no change. Added to next.config.js file: config.plugins.push(
new FilterWarningsPlugin({
exclude: [
/mongodb/,
/mssql/,
/mysql/,
/mysql2/,
/oracledb/,
/pg-native/,
/pg-query-stream/,
/react-native-sqlite-storage/,
/redis/,
/sqlite3/,
/sql.js/,
/typeorm-aurora-data-api-driver/,
],
})
); Note, I'm using postgres, so am keeping
Note the issue is now directly with |
+ to the issue Since NextJs 11 has moved to webpack 5, NextAuth became absolutely unusable: It simply doesn't allow to build the project without resolving all of these database packages |
@TeosVerdi it looks like the target declared in your next config cannot be serverless. I'm not 100% on what it means to change that config unfortunately, but it does allow for build. |
@TeosVerdi we do have a running demo page at https://github.com/nextauthjs/next-auth-example that runs on Vercel, using Next.js 11, so saying it is absolutely unusable is a bit of an exaggeration. Maybe you could rather provide a reproduction of your problem, so we can have a look together and see what can be done? 🙂 +1 commenting an issue has absolutely no value for us in helping you. @bcnichols3 you are right, see my comment below! |
vercel/next.js#20487 (comment) vercel/next.js#20790 (comment) The Next.js team generally doesn't recommend using So I am not sure there is anything for us to do here: 🤷 I checked the reproduction here #988 (comment) and simply removing So if OP @s-kris approves this as a workaround, I'll close this issue. |
@balazsorban44 is there a writeup as to what I wasn't getting warnings, I was getting full-blown errors so burned some cycles trying to figure out WTH was wrong. For those that come later maybe it'd be great to have some extra explanation here. |
I am not sure of the state, but regardless, it is certainly not a problem of NextAuth.js. |
Thanks @balazsorban44 for clearing this up. Looks like the |
@s-kris I'm still having this problem, and I'm not using Having anything at all in the `Failed to compile. ModuleNotFoundError: Module not found: Error: Can't resolve 'react-native-sqlite-storage' in '/Users/adamdarby/nextjs/nerd-trivia-redux/node_modules/typeorm/browser/driver/react-native'` I'm using Next 11.
|
@balazsorban44 next.config.js
build error:
Asking to reopen the issue, since it's not resolved completely. |
The OP's issue is resolved, so I recommend opening a new bug report with a reproduction. 😊 |
Seems like for google, twitter etc it is able to import when using, next-auth/providers/{{package}}
I do not see any module export for |
Your question
Are typeorm warnings during build time caused by next-auth?
What are you trying to do
I'm getting the following warnings when I try to build my nextjs project. I used postgres connection for db connection.
Reproduction
Feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
The text was updated successfully, but these errors were encountered: