Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to import - @supabase/[email protected] dependency #572

Closed
iuioiua opened this issue Mar 30, 2023 · 8 comments
Closed

Failed to import - @supabase/[email protected] dependency #572

iuioiua opened this issue Mar 30, 2023 · 8 comments
Labels
deno Not working in Deno

Comments

@iuioiua
Copy link

iuioiua commented Mar 30, 2023

Failing module

import { something } from "https://esm.sh/@supabase/[email protected]"

Error message

After running deno info https://esm.sh/@supabase/[email protected], the file https://esm.sh/v113/@supabase/[email protected]/dist/module/lib/types/dist/module/index.d.ts was reported as missing. It's pointed to by https://esm.sh/v113/@supabase/[email protected]/dist/index.d.ts for some reason.

This missing file slows down startup times as the startup pauses until concluding that this file is missing. As a workaround, I've had to deno run --cached-only...

Is this a fault of the package or ESM?

Additional info

  • esm.sh version: v113
  • Deno version: v1.32.1

Related:

  • supabase/auth-helpers#471
@iuioiua iuioiua added the deno Not working in Deno label Mar 30, 2023
@ije
Copy link
Member

ije commented Mar 30, 2023

thanks, i will look into it.

@iuioiua
Copy link
Author

iuioiua commented Mar 30, 2023

Thank you 🙏🏾
FYI, this is for https://github.com/denoland/saaskit

@marvinhagemeister
Copy link
Contributor

I took a look into this and can confirm that this is an error in the resolution logic of esm.sh. Currently, we only consider paths in package.json to be a valid resolution targets. This works pretty well for the majority of cases, but is different from how TypeScript resolves types.

The https://esm.sh/v113/@supabase/[email protected]/dist/index.d.ts file has a relative import to @supabase/supabase-js/dist/module/lib/types:

import * as _supabase_supabase_js_dist_module_lib_types from '@supabase/supabase-js/dist/module/lib/types';

But because there is no .exports entry in package.json in @supabase/supabase-js it just falls back to the value defined in .types and appends that to the current path. That's wrong because that is intended for the main entry. Instead what should have happened is that esm.sh checks first if there is a @supabase/supabase-js/dist/module/lib/types.d.ts file. That will return the correct typing file.

Problem is that the current architecture doesn't store these in esm.sh's internal cache.

@ije
Copy link
Member

ije commented Apr 5, 2023

as @marvinhagemeister pointed out, the types url https://esm.sh/v113/@supabase/[email protected]/dist/module/lib/types/dist/module/index.d.ts is incorrect, it should be https://esm.sh/v113/@supabase/[email protected]/dist/module/lib/types.d.ts, i'm looking into.

@ije ije closed this as completed in 77e35bf Apr 5, 2023
@iuioiua
Copy link
Author

iuioiua commented Apr 6, 2023

Thank you! When can we expect a new release for these fixes?

@ije
Copy link
Member

ije commented Apr 6, 2023

Thank you! When can we expect a new release for these fixes?

working on it

@ije
Copy link
Member

ije commented Apr 6, 2023

done! @iuioiua can you please confirm? thanks

@iuioiua
Copy link
Author

iuioiua commented Apr 6, 2023

Issue fixed! Thank you very much 🙏🏾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deno Not working in Deno
Projects
None yet
Development

No branches or pull requests

3 participants