Skip to content

Commit 77ee9df

Browse files
fix: set default next pages export to client version, matching the default export (#3549)
* default pages export should be the client version * added a changeset
1 parent 6407531 commit 77ee9df

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@posthog/next': patch
3+
---
4+
5+
Fix `@posthog/next/pages` default export condition to resolve to the client barrel (`pages.client.js`) instead of the server barrel (`pages.js`), matching the behavior of the root `"."` export. This prevents bundlers that don't match a more specific condition from pulling in `server-only` and `posthog-node` unnecessarily.

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"worker": "./dist/pages.edge.js",
3939
"browser": "./dist/pages.client.js",
4040
"react-server": "./dist/pages.js",
41-
"default": "./dist/pages.js"
41+
"default": "./dist/pages.client.js"
4242
}
4343
},
4444
"main": "./dist/index.client.js",

packages/next/tests/packaging.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('package.json#exports routing', () => {
5050
expect(pages.edge).toBe('./dist/pages.edge.js')
5151
expect(pages.worker).toBe('./dist/pages.edge.js')
5252
expect(pages['react-server']).toBe('./dist/pages.js')
53-
expect(pages.default).toBe('./dist/pages.js')
53+
expect(pages.default).toBe('./dist/pages.client.js')
5454
})
5555

5656
it('. (root entry) keeps the existing per-runtime split intact', () => {

0 commit comments

Comments
 (0)