auth0/node-auth0

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

cysp opened this issue · 1 comments

cysp commented

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

Thanks!