auth-helpers icon indicating copy to clipboard operation
auth-helpers copied to clipboard

NextJs - middleware import

Open carledwardfp opened this issue 2 years ago • 5 comments

Description

'@supabase/auth-helpers-nextjs/middleware' is not found. I used '@supabase/auth-helpers-nextjs/dist/middleware' instead. Also, NextJs replaced the middleware API to only have a single root middleware file. New API Link. This might have a breaking change for withMiddlewareAuth

carledwardfp avatar Jul 08 '22 12:07 carledwardfp

'@supabase/auth-helpers-nextjs/middleware' is not found. I used '@supabase/auth-helpers-nextjs/dist/middleware' instead.

I wonder if that ever worked. Without hacky tricks afaik having path imports is still a nightmare in typescript.

boredland avatar Jul 10 '22 15:07 boredland

Maybe the "typesVersions" key in package.json is what you are looking for

david-plugge avatar Jul 10 '22 17:07 david-plugge

Not sure I understand how that could help. What could actually help IMO, is if we use the exports fields together with ts 4.7.x - Will give that a try.

boredland avatar Jul 10 '22 17:07 boredland

hm. I don't get how to make that work.

boredland avatar Jul 10 '22 18:07 boredland

thanks for the hint reg. typesVersions. Made it work in https://github.com/supabase-community/auth-helpers/pull/170 thanks to this explanation.

boredland avatar Jul 10 '22 19:07 boredland