No `exports` map, and the ESM build has extensionless imports Node can't load

Open
#318 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
56/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Domain
build-system

Research direction

Start in package.json, where main/module are set and exports is missing, then look at the build config (the tool producing dist/module) to see why relative imports are emitted without extensions. Compare against the exports maps in @supabase/storage-js and @supabase/postgrest-js as the template. Done looks like node --input-type=module -e "import('@supabase/ssr')" resolving to the ESM build and the per-module import no longer throwing ERR_MODULE_NOT_FOUND, with the CJS require path still working.

Written by the indexing model from the issue text.

Description

@supabase/ssr 0.12.7 has main and module but no exports map and no "type": "module". Node therefore always loads the CommonJS build, even from an ESM import. The module build can't be loaded by Node at all, because its relative imports have no file extension:

// dist/module/index.js
export * from "./createBrowserClient";
export * from "./createServerClient";

node --input-type=module -e "import('@supabase/ssr/dist/module/index.js')" fails with ERR_MODULE_NOT_FOUND.

The ESM build is only reachable through bundlers that read module. Server runtimes that don't bundle (Node, Bun, Deno via npm) run the CommonJS build, and ESM-only tooling (Vitest in some modes, tsx, Node's --experimental-strip-types workflows) gets CJS interop instead of real ESM.

Fix

Ship Node-valid ESM (.js extensions in relative imports, or .mjs output) and an exports map with import and require conditions, as @supabase/storage-js, @supabase/postgrest-js and @supabase/supabase-js already do. sideEffects: false is already set and can stay.

Dominant language
TypeScript
Stars
216
Forks
35
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/ssr

All issues in supabase/ssr

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.