You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using v4.0.0-beta.7 and my tsconfig.json has "moduleResolution": "node". I cannot import types via @auth0/nextjs-auth0/server as documented (webpack is able to load it ok). I've tried switching my module resolution to typescript's recommended suggestions ("node16", "nodenext", or "bundler"), however any of those end up breaking imports for other libraries I'm using.
Typescript can import from @auth0/nextjs-auth0/dist/server, but then webpack (potentially other bundlers as well) has issues importing from there.
Describe the ideal solution
Ideally we would be able to import the types even when moduleResolution is set to "node". This worked in v3 and I haven't run into this issue with any other libraries yet.
Alternatives and current workarounds
A workaround is to create a path alias in tsconfig:
Another possible workaround (untested) is to import from @auth0/nextjs-auth0/dist/server and teach the bundler (webpack in this case) how to handle that properly. This seems less ideal having to import from /dist.
Additional context
I was going to file this as a bug, but it requires checking that:
...which is coded against v3 and doesn't seem to use typescript. It might be worth updating that to be an optional checkmark now that v4 is the main focus
The text was updated successfully, but these errors were encountered:
Hey @redbmk 👋 Thanks for reporting this! We're now including typeVersions which should help TypeScript resolve the types when the moduleResolution is set to node. This should be available in the next release.
I ran into this same issue after attempting to upgrade my project to use v4.0.0-beta.9. However, the workaround provided by @redbmk didn't work for me. I am on the brink of giving up. Any idea when the next release will be pushed?
Checklist
Describe the problem you'd like to have solved
I'm using
v4.0.0-beta.7
and my tsconfig.json has"moduleResolution": "node"
. I cannot import types via@auth0/nextjs-auth0/server
as documented (webpack is able to load it ok). I've tried switching my module resolution to typescript's recommended suggestions ("node16", "nodenext", or "bundler"), however any of those end up breaking imports for other libraries I'm using.Typescript can import from
@auth0/nextjs-auth0/dist/server
, but then webpack (potentially other bundlers as well) has issues importing from there.Describe the ideal solution
Ideally we would be able to import the types even when moduleResolution is set to "node". This worked in v3 and I haven't run into this issue with any other libraries yet.
Alternatives and current workarounds
A workaround is to create a path alias in tsconfig:
Another possible workaround (untested) is to import from
@auth0/nextjs-auth0/dist/server
and teach the bundler (webpack in this case) how to handle that properly. This seems less ideal having to import from/dist
.Additional context
I was going to file this as a bug, but it requires checking that:
...which is coded against v3 and doesn't seem to use typescript. It might be worth updating that to be an optional checkmark now that v4 is the main focus
The text was updated successfully, but these errors were encountered: