Files
Dustin ByrneandGitHub d81439f927 fix(browser): fix slim bundle + extension bundles crash from inconsistent property mangling (#3316)
* test: add playwright tests for slim bundle + extension bundles (#3313)

Regression tests that load the actual built module.slim.js and
extension-bundles.js in a browser and exercise every extension bundle.

* fix: share terser nameCache across entries for consistent property mangling

Without a shared nameCache, terser independently mangles _-prefixed
properties to different short names in each rollup entry, causing runtime
crashes when module.slim.js and extension-bundles.js are combined.

Top-level variable names (vars) are reset per-entry since each ES module
has its own scope.

Fixes #3313

* test: post-build check for cross-bundle mangling consistency

Parses source maps after every build to verify that all shared _-prefixed
properties were mangled to the same short names. Fails the build with
exact diagnostics if they diverge.

* chore: add changeset

* review: parameterise duplicate init tests, stricter mismatch check
2026-04-01 17:03:15 -04:00

45 lines
1.5 KiB
HTML

<html>
<head>
<title>PostHog Slim Bundle + Extension Bundles Test</title>
</head>
<body>
<h1>Slim Bundle Test</h1>
<div id="status">loading...</div>
<script type="module">
import posthog from '/dist/module.slim.js'
import {
AllExtensions,
FeatureFlagsExtensions,
ErrorTrackingExtensions,
ToolbarExtensions,
SurveysExtensions,
SessionReplayExtensions,
AnalyticsExtensions,
ExperimentsExtensions,
ConversationsExtensions,
LogsExtensions,
ProductToursExtensions,
SiteAppsExtensions,
TracingExtensions,
} from '/dist/extension-bundles.js'
window.posthog = posthog
window.AllExtensions = AllExtensions
window.FeatureFlagsExtensions = FeatureFlagsExtensions
window.ErrorTrackingExtensions = ErrorTrackingExtensions
window.ToolbarExtensions = ToolbarExtensions
window.SurveysExtensions = SurveysExtensions
window.SessionReplayExtensions = SessionReplayExtensions
window.AnalyticsExtensions = AnalyticsExtensions
window.ExperimentsExtensions = ExperimentsExtensions
window.ConversationsExtensions = ConversationsExtensions
window.LogsExtensions = LogsExtensions
window.ProductToursExtensions = ProductToursExtensions
window.SiteAppsExtensions = SiteAppsExtensions
window.TracingExtensions = TracingExtensions
window.__slim_bundle_ready = true
</script>
</body>
</html>