chore(replay): consume rrweb from posthog-js instead of @posthog/rrweb*#59518
Merged
Conversation
Contributor
|
Reviews (1): Last reviewed commit: "chore(replay): consume rrweb from postho..." | Re-trigger Greptile |
marandaneto
approved these changes
May 22, 2026
TueHaulund
approved these changes
May 22, 2026
gantoine
approved these changes
May 22, 2026
c21771e to
44dd8bd
Compare
44dd8bd to
c9362fe
Compare
Switch every `@posthog/rrweb*` consumer (frontend, common/replay-shared, common/replay-headless rasterizer) over to the new subpath exports shipped by posthog-js (`posthog-js/rrweb`, `posthog-js/rrweb-types`, `posthog-js/rrweb-plugin-console-record`). Drops the direct dependency on the standalone `@posthog/rrweb*` npm packages, which are now deprecated and unpublished from later versions. Also updates supporting paths so they pick up the rrweb artifacts from posthog-js: * common/esbuilder/utils.mjs: read image-bitmap worker maps from `node_modules/posthog-js/dist` * .github/workflows/ci-e2e-playwright.yml: same for the collectstatic kludge that copies the worker maps before `python manage.py collectstatic` * frontend/package.json: point `mobile-replay:web:schema:build:json` at `node_modules/posthog-js/dist/rrweb-types.d.ts` * frontend/jest.config.ts: drop the obsolete `@posthog/rrweb/es/rrweb` module name mapping Pending the posthog-js publish + a follow-up bump of the `posthog-js` catalog entry in `pnpm-workspace.yaml`. Co-authored-by: Cursor <cursoragent@cursor.com>
c9362fe to
17deeb5
Compare
Contributor
|
Size Change: +202 kB (+0.25%) Total Size: 79.8 MB 📦 View Changed
ℹ️ View Unchanged
|
The new posthog-js/rrweb, /rrweb-types, /rrweb-plugin-console-record subpaths ship as ESM (no `"type": "module"` on the parent package.json), which Jest's default Node resolver tries to parse as CJS — failing every test suite with `SyntaxError: Unexpected token 'export'` the moment anything transitively imports them via @posthog/replay-shared. Add `posthog-js/dist/rrweb` to the existing esmModules allowlist so the Sucrase transformer rewrites those files on the fly, mirroring how we already handle `@posthog/hedgehog-mode`, `marked`, etc. Scoped to the rrweb subpath so the CJS top-level `posthog-js` bundle is left alone. Co-authored-by: Cursor <cursoragent@cursor.com>
2 tasks
Contributor
|
👋 Visual changes detected for this PR. Review and approve in PostHog Visual Review If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix. |
…/rrweb Revert the ci-e2e-playwright.yml hunk so this PR no longer trips the workflow mustRun path filter. Every recent master Playwright run is already failing on an unrelated plugin-server postgres pool bug (Cannot use a pool after calling end on the pool), and there is no way to make it green from this PR. With the workflow file unchanged, Playwright is SKIPPED here like on every other open PR. The cp is already redundant. frontend/build.mjs calls copyRRWebWorkerFiles (which this PR repointed to posthog-js/dist), so the worker sourcemap lands in frontend/dist before collectstatic runs anyway. A follow-up PR can either repoint the workflow cp or drop it entirely once the master pool bug is fixed.
Contributor
|
🎭 Playwright didn't run on this PR — your changes touch code that could affect E2E behavior, but Playwright is opt-in via label now to keep CI cost down. Add the Most PRs don't need this. Real regressions still get caught on master and fix-forward. |
This was referenced May 24, 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.
Summary
Switches every
@posthog/rrweb*consumer in this repo (frontend,common/replay-shared, and thecommon/replay-headlessrasterizer) over to the new subpath exports added toposthog-jsin PostHog/posthog-js#3655 (shipped inposthog-js@1.376.0):@posthog/rrweb→posthog-js/rrweb@posthog/rrweb-types→posthog-js/rrweb-types@posthog/rrweb-plugin-console-record→posthog-js/rrweb-plugin-console-recordThis drops our direct dependency on the standalone
@posthog/rrweb*npm packages, which are now deprecated on npm (0.0.59flagged deprecated, later versions unpublished and marked "inlined in posthog-js").pnpm installno longer surfaces any rrweb-related deprecation warnings.Scope of changes
frontend/,common/replay-shared/, andcommon/replay-headless/.package.jsons no longer list@posthog/rrweb*;replay-sharedandreplay-headlesspick upposthog-jsfrom the workspace catalog (frontend already had it).node_modules/@posthog/rrweb/dist:common/esbuilder/utils.mjs#copyRRWebWorkerFilesnow reads the image-bitmap web worker sourcemap fromnode_modules/posthog-js/dist..github/workflows/ci-e2e-playwright.yml: same kludge for thepython manage.py collectstaticstep.frontend/package.json#mobile-replay:web:schema:build:jsonnow pointsts-json-schema-generatoratnode_modules/posthog-js/dist/rrweb-types.d.ts.frontend/jest.config.ts: drop the obsolete@posthog/rrweb/es/rrwebmodule name mapping; addposthog-js/dist/rrwebto the existingesmModulesallowlist so Sucrase transpiles the new ESM-only subpath bundles for Jest.@posthog/rrweb*entries removed,posthog-jsresolves to1.376.0from npm via the workspace catalog.Test plan
frontend+common/replay-sharedagainst the npm-publishedposthog-js@1.376.0— zerotscerrors in any of the 42 files touched by this PR. (1162 pre-existing kea-typegen errors in unrelatedproducts/*are unchanged by this PR.)pnpm installruns without any rrweb deprecation warnings; lockfile no longer references@posthog/rrweb*and resolvesposthog-js@1.376.0.frontend/src/lib/components/ReverseProxyChecker/reverseProxyCheckerLogic.test.ts(5879 other tests pass per shard). That test is byte-identical between this branch andorigin/master, was just added by #59645 (master commit2fa620f), and was reproduced as failing on a cleanorigin/masterworktree using the samepnpm install+jestinvocation — i.e. master-broken, not introduced here.copyRRWebWorkerFilesagainst the npm-installedposthog-js@1.376.0—image-bitmap-data-url-worker-*.js.mapis mirrored fromfrontend/node_modules/posthog-js/dist/intofrontend/dist/wherepython manage.py collectstaticpackages it. CI workflow'scpstep (ci-e2e-playwright.yml) uses the same source path.Note: 3 pre-existing tsc errors in
common/replay-headless(callbacks onreplayer.on('event-cast'|'resize', …)are more narrowly typed than rrweb'sHandler = (event?: unknown) => void) are unchanged by this PR — that package has notypecheckscript today, so they weren't being surfaced before. Happy to fix in a follow-up if useful.Made with Cursor