fix: enable tree-shaking for browser bundles#216
Merged
Conversation
grdsdev
approved these changes
May 7, 2026
mandarini
pushed a commit
that referenced
this pull request
May 7, 2026
🤖 I have created a release *beep* *boop* --- ## [0.10.3](v0.10.2...v0.10.3) (2026-05-07) ### Bug Fixes * allow cookies encode without getAll/setAll on browser client ([#213](#213)) ([89f3f28](89f3f28)), closes [#170](#170) * enable tree-shaking for browser bundles ([#216](#216)) ([f009d71](f009d71)) * **tsconfig:** set explicit rootDir to silence TS6059 in consumer IDEs ([#211](#211)) ([a77ee8a](a77ee8a)), closes [#209](#209) * validate base64-prefixed chunked cookies decode to valid JSON ([#210](#210)) ([302cc0e](302cc0e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
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.
What kind of change does this PR introduce?
Bug fix. Closes #92.
What is the current behavior?
@supabase/ssris not tree-shakeable. A browser bundle that imports onlycreateBrowserClientstill carriescreateServerClientbecause (a)package.jsondoes not declare"sideEffects": falseand (b)src/index.tsruns a top-levelprocess.env.npm_package_namecheck at module load, which is a real side effect.What is the new behavior?
package.jsondeclares"sideEffects": false(and adds an explicit"types"field).src/warnDeprecatedPackage.tsas a function called fromcreateBrowserClientandcreateServerClienton first construction, with a once-per-process guard.src/index.tsis reduced to pure re-exports.No API changes. The only behavioral shift is the warning timing: first construction instead of module import.
Verified: 81 tests pass,
createServerClientdrops out of an esbuild browser bundle that imports onlycreateBrowserClient, the warning fires once and only after a client is constructed.Additional context
Subpath exports (
@supabase/ssr/client,/server) were considered and left out: they would be largely cosmetic on top of"sideEffects": false, and an"exports"map breaks deep imports into internal paths. Worth a deliberate design pass for a future major. Thewsandcryptosymbols in the original screenshot come from@supabase/supabase-jstransitives and node-polyfill bundler plugins, neither of which this PR touches.