Skip to content

fix: set default next pages export to client version, matching the default export#3549

Merged
dustinbyrne merged 2 commits into
PostHog:mainfrom
brandonhines-mialabs:bug/fix-default-next-pages-export
May 13, 2026
Merged

fix: set default next pages export to client version, matching the default export#3549
dustinbyrne merged 2 commits into
PostHog:mainfrom
brandonhines-mialabs:bug/fix-default-next-pages-export

Conversation

@brandonhines-mialabs
Copy link
Copy Markdown
Contributor

Problem

Users importing from @posthog/next/pages in environments where no specific export condition matches (i.e. the default fallback is used) will resolve to the server barrel (pages.js), which transitively imports server-only and posthog-node. This causes build failures in client-side contexts. The root "." export already defaults to the client barrel, but "./pages" was inconsistent.

Changes

Updated the default export condition for "./pages" in package.json from ./dist/pages.js (server) to ./dist/pages.client.js (client), matching the pattern used by the root "." export. Updated the corresponding packaging test assertion to reflect the new default.

Release info Sub-libraries affected

Libraries affected

  • All of them
  • posthog-js (web)
  • posthog-js-lite (web lite)
  • posthog-node
  • posthog-react-native
  • @posthog/react
  • @posthog/ai
  • @posthog/convex
  • @posthog/next
  • @posthog/nextjs-config
  • @posthog/nuxt
  • @posthog/rollup-plugin
  • @posthog/webpack-plugin
  • @posthog/types

Checklist

  • Tests for new code
  • Accounted for the impact of any changes across different platforms
  • Accounted for backwards compatibility of any changes (no breaking changes!)
  • Took care not to unnecessarily increase the bundle size

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

@brandonhines-mialabs is attempting to deploy a commit to the PostHog Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 7, 2026

Reviews (1): Last reviewed commit: "added a changeset" | Re-trigger Greptile

@brandonhines-mialabs
Copy link
Copy Markdown
Contributor Author

@dustinbyrne hey sorry, follow up fix for #3533

Copy link
Copy Markdown
Contributor

@dustinbyrne dustinbyrne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@dustinbyrne dustinbyrne merged commit 77ee9df into PostHog:main May 13, 2026
43 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants