fix(misc): hide dynamic import from hermesc#2381
Merged
Merged
Conversation
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
Contributor
Author
|
Published as |
This was referenced May 19, 2026
Rolldown's printer only preserves block comments containing @__PURE__, @__NO_SIDE_EFFECTS__, or @vite-ignore. Standalone webpackIgnore / turbopackIgnore blocks were stripped from dist/index.mjs, leaving the surviving @vite-ignore alone and breaking Next.js Edge / Turbopack builds. Merging all three directives into a single @vite-ignore-bearing comment lets rolldown keep the entire block; webpack and turbopack both scan for their keyword anywhere in adjacent comments. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9a0a319 to
1a3f34b
Compare
Contributor
Author
|
Beta testing works, tests pass across all dogfed repos |
Coly010
approved these changes
May 20, 2026
This was referenced May 20, 2026
mandarini
pushed a commit
to supabase/ssr
that referenced
this pull request
May 20, 2026
This PR updates `@supabase/supabase-js` to v2.106.1. **Source**: supabase-js-stable-release --- ## Release Notes ## v2.106.1 ## 2.106.1 (2026-05-20) ### 🩹 Fixes - **auth:** encode client-id in oauth requests ([#2383](supabase/supabase-js#2383)) - **misc:** hide dynamic import from hermesc ([#2381](supabase/supabase-js#2381)) ### ❤️ Thank You - Etienne Stalmans @staaldraad - Katerina Skroumpelou @mandarini This PR was created automatically. Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
|
Gm |
This was referenced May 25, 2026
mandarini
pushed a commit
to supabase/supabase
that referenced
this pull request
May 25, 2026
This PR updates @supabase/*-js libraries to version 2.106.2. **Source**: supabase-js-stable-release **Changes**: - Updated @supabase/supabase-js to 2.106.2 - Updated @supabase/auth-js to 2.106.2 - Updated @supabase/realtime-js to 2.106.2 - Updated @supabase/postgest-js to 2.106.2 - Refreshed pnpm-lock.yaml --- ## Release Notes ## v2.106.2 ## 2.106.2 (2026-05-25) ### 🩹 Fixes - **auth:** restore signup user response ([#2391](supabase/supabase-js#2391)) - **misc:** add react-native export condition for Hermes-safe resolution ([#2393](supabase/supabase-js#2393)) ### ❤️ Thank You - Myroslav Hryhschenko @BLOCKMATERIAL - Vaibhav @7ttp ## v2.106.1 ## 2.106.1 (2026-05-20) ### 🩹 Fixes - **auth:** encode client-id in oauth requests ([#2383](supabase/supabase-js#2383)) - **misc:** hide dynamic import from hermesc ([#2381](supabase/supabase-js#2381)) ### ❤️ Thank You - Etienne Stalmans @staaldraad - Katerina Skroumpelou @mandarini This PR was created automatically. Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
This was referenced Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
v2.106.0introduced@supabase/tracingwith a dynamicimport('@opentelemetry/api'). Rolldown bundles@supabase/tracing's ESM source intodist/index.cjsofsupabase-js(it prefers ESM for tree-shaking), so the literalimport()ends up in the CJS bundle.hermesc— the Hermes bytecode compiler used for every React Native release build — rejectsimport()at parse time, before any dead-code elimination, breaking every RN release build withInvalid expression encountered.The ESM build of supabase-js has a parallel problem: when downstream consumers build through Turbopack / webpack / Vite without
@opentelemetry/apiinstalled, those bundlers try to statically resolve the specifier and fail withModule not found: Can't resolve '@opentelemetry/api'. Magic comments suppress this — but Rolldown drops them, and Turbopack only honors them in a specific shape.Fixes #2380.
Fix
Two independent changes in
packages/core/supabase-js/tsdown.config.ts:1. CJS bundle — alias
@supabase/tracingto its CJSmainfiletsc's CJS emit (packages/shared/tracing/dist/main/index.js) already lowersimport()torequire(). The alias bypasses theimportexport condition Rolldown'splatform: 'node'default would otherwise pick. Result:dist/index.cjsends up withrequire()(Hermes-safe; also CSP-safe — nonew Function()).dist/index.mjskeeps nativeimport()(valid ESM; Metro resolves therequirecondition for React Native and never sees the ESM bundle).2. ESM bundle — inject canonical bundler-ignore comments after rolldown's printer runs
Rolldown's printer only preserves comments containing
@vite-ignore,@__PURE__, or@__NO_SIDE_EFFECTS__— standalone/* webpackIgnore */and/* turbopackIgnore */blocks get stripped. Turbopack only honors/* turbopackIgnore: true */when it occupies its own block (every Next.js internal usage is single-purpose; multi-keyword blocks are silently ignored — this is what broke2.106.1-beta.2on Vercel). The two constraints cannot be satisfied from source.The plugin runs after rolldown's printer and rewrites every
import()indist/index.mjsinto the canonical single-purpose shape that all three bundlers accept.extract.tsis correspondingly reverted to a bareimport(OTEL_PKG)— source-side magic comments are dead weight.Regression test
packages/core/supabase-js/test/bundle-hermes-compat.test.cjs(wired into themodule-resolutionCI job) asserts three properties of the built dist files:dist/index.cjscontains noimport(expression — Hermes-safe / React Native compatible.dist/index.cjscontains nonew Function(— browser strict-CSP safe.import(indist/index.mjsis in the canonical shape:/* webpackIgnore: true */ /* turbopackIgnore: true */ /* @vite-ignore */ <ident>, each directive in its own block. Multi-keyword blocks fail this check explicitly.Verification
2.106.1-beta.0confirmed working for Hermes/RN by @sbs44, @ryanshepps, @7ttp.expo export:embed+hermesc) exits 0.