The bun-plugin dev server (stx-serve / bun packages/bun-plugin/dist/serve.js pages/) silently dropped analytics injection.
Two causes in packages/bun-plugin/src/serve.ts:
- It sources its main config from bunfig's
loadConfig(the raw object) and only consults theloadStxConfig()result for_pluginComponentDirs/_pluginPageDirs. A plugin'ssetup()can mutate the loaded config — e.g. an analytics plugin settinganalytics.{enabled,driver,custom}— but that mutation never reached the served config. - The
processDirectivesoptions allowlist omittedanalytics, so even a presentanalyticswouldn't be forwarded — and theinjectAnalyticsgate (opts.analytics?.enabled) was always falsy.
Fix: carry the plugin-mutated analytics from the loadStxConfig() result onto stxConfig, and add analytics to the options allowlist (both serve branches). Now both native providers (fathom/GA/plausible/self-hosted) and plugin-injected trackers inject on this serve path, matching the SSG and stx dev/stx serve CLI paths.
Surfaced while building the @stacksjs/ts-analytics stx plugin (stacksjs/ts-analytics#123), whose setup() adapts { appId } into analytics.custom.
🤖 Generated with Claude Code