Skip to content
New issue

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

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

Already on GitHub? # to your account

v4 Beta: "Module not found: Default condition should be last one" #912

Closed
5 tasks done
cysp opened this issue Aug 19, 2023 · 1 comment
Closed
5 tasks done

v4 Beta: "Module not found: Default condition should be last one" #912

cysp opened this issue Aug 19, 2023 · 1 comment
Labels
bug This points to a verified bug in the code

Comments

@cysp
Copy link
Contributor

cysp commented Aug 19, 2023

Checklist

  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

Attempting to import node-auth0 v4.0.0-beta.7 into a Next.js app fails with the error "Module not found: Default condition should be last one".
This appears to be a constraint enforced by webpack:
https://github.com/webpack/enhanced-resolve/blob/3a28f47788de794d9da4d1702a3a583d8422cd48/lib/util/entrypoints.js#L472-L476

And reading Node.js documentation indicates that it's for a valid reason, in that the order of keys matters and an implementation must choose the first matching entry (and default always matches):
https://nodejs.org/api/packages.html#conditional-exports

The change that I believe is necessary is this:
beta...cysp:node-auth0:beta-package-json-import-order

Reproduction

  1. add node-auth0 v4.0.0-beta.7 to next.js app (or probably any project that uses webpack)
  2. build app

Additional context

No response

node-auth0 version

4.0.0-beta.7

Node.js version

18.17.1

@cysp cysp added the bug This points to a verified bug in the code label Aug 19, 2023
@frederikprijck
Copy link
Member

Thanks!

@frederikprijck frederikprijck mentioned this issue Aug 22, 2023
3 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug This points to a verified bug in the code
Projects
None yet
Development

No branches or pull requests

2 participants