supabase-community / auth-ui

Pre-built Auth UI for React
https://supabase.com/docs/guides/auth/auth-helpers/auth-ui
MIT License
486 stars 120 forks source link

Types no longer resolve when using module resolution NodeNext #144

Closed andrew-w-ross closed 1 year ago

andrew-w-ross commented 1 year ago

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'..

silentworks commented 1 year ago

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.

andrew-w-ross commented 1 year ago

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