auth0 / node-auth0

Node.js client library for the Auth0 platform.
MIT License
630 stars 309 forks source link

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

Closed cysp closed 1 year ago

cysp commented 1 year ago

Checklist

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: https://github.com/auth0/node-auth0/compare/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

frederikprijck commented 1 year ago

Thanks!