supabase-community/auth-ui

Types no longer resolve when using module resolution NodeNext

andrew-w-ross opened this issue · 2 comments

Bug report

Describe the bug

When trying to import @supabase/auth-ui-react the types are no longer found if the tsconfig module resolution is set to NodeNext. This was working in version 0.2.7 so it's a recent change that broke it.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

Build will fail with error on the lines of:

@example/react:build:example: src/App.tsx(4,22): error TS7016: Could not find a declaration file for module '@supabase/auth-ui-react'

Expected behavior

For the types to resolve

Additional context

Looks like there might be an issue on the package.json export.

It should export the type as well, something like this:

"exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.es.js",
      "require": "./dist/index.cjs.js"
    }
  },

Changing that does resolve the type you can confirm that by running pnpm tsc --traceResolution | grep @supabase/auth-ui-react inside of the react example folder. But then a new error pops up of src/App.tsx(4,10): error TS2305: Module '"@supabase/auth-ui-react"' has no exported member 'Auth'..

This has been fixed in the latest release of the library. You will not notice this fix if you are using the example in this repo but if you import the Auth UI in an existing app that uses NodeNext moduleResolution then it should work.

@silentworks Thanks version 0.3.3 works. I really appreciate the quick turn around on this.