Skip to content

Conversation

@7ttp
Copy link
Contributor

@7ttp 7ttp commented Dec 3, 2025

Fixes #1880

Problem

ESM imports fail with ERR_MODULE_NOT_FOUND in Nuxt 3 and other strict ESM environments because the dist/module build has imports without .js extensions.

Solution

Add an ESM wrapper that re-exports from the CommonJS build, following the same pattern used by postgrest-js.

Changes

  • Add exports field to package.json for proper ESM/CJS resolution
  • Add wrapper.mjs that re-exports all exports from the CJS build
  • Add scripts/copy-wrapper.cjs to copy wrapper during build
  • Update module field to point to the wrapper

Tested

  • ESM import works via wrapper
  • CJS import still works
  • Direct imports to dist/module/* still work (for Deno tests)

cc @mandarini

@7ttp 7ttp requested a review from a team as a code owner December 3, 2025 14:21
@coveralls
Copy link

Coverage Status

coverage: 95.367% (+14.2%) from 81.173%
when pulling 8fc97e4 on 7ttp:Nuxt1
into 8769da9 on supabase:master.

@mandarini mandarini self-assigned this Dec 3, 2025
@mandarini mandarini added the supabase-js Related to the supabase-js library. label Dec 3, 2025
@mandarini mandarini merged commit 2596a09 into supabase:master Dec 3, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

supabase-js Related to the supabase-js library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

^2.82.0: "Cannot find module" error in Nuxt environment (2.83, 2.84)

3 participants