build.ts was generateStaticSite({ outputDir: 'dist' }) — a static dashboard site, not a library. So dist/ had only 404.html + assets, and the entry points package.json references (module/exports/types → dist/index.js, dist/integrations/stx.js, dist/index.d.ts) never existed. Neither @stacksjs/ts-analytics nor @stacksjs/ts-analytics/stx (the tsAnalytics() module from #0047f42) was importable once installed/published — it only worked from source.
Fix
build.ts→Bun.buildover the.and./stxentrypoints (src/index.ts+src/integrations/stx.ts),bun-plugin-dtsxfor declarations,packages: 'external'→dist/index.js+dist/integrations/stx.js+ both.d.ts.- Dashboard site moves to
bun run build:site→dist-site/(so the SSG'scleanOutputstops wiping the library).preview.tsfollows. Lambda deploy untouched — it usesscripts/build-views.ts. - Tracker hardening:
JSON.stringifysiteId/apiEndpointinbuildConfigSection(was raw single-quote interpolation — a quote/</script>/newline breakout for any inline-tracker consumer).
Verified
bun run build→dist/index.js+dist/integrations/stx.js+ both.d.ts.@stacksjs/ts-analytics/stxresolvestsAnalytics/tsAnalyticsTag;tsAnalyticsTag({ appId: 'bench-review', apiEndpoint: 'http://localhost:2027' })→<script defer data-site="bench-review" src="http://localhost:2027/script.js"></script>.- Existing analytics tests: 157 pass / 0 fail.
Stacks on top of your feat(integrations) 0047f42 (the tsAnalytics() integration) — this just makes it shippable.