:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import type { Plugin } from 'vite'
/**
* Import `.sql` files as raw strings (e.g. `import query from './foo.sql'`).
* The webpack build did this via `type: 'asset/source'`; Vite has no built-in
* equivalent for a bare import (only the explicit `?raw` suffix), so map it here.
*/
export function sqlRawPlugin(): Plugin {
return {
name: 'posthog-storybook-sql-raw',
transform(code, id) {
if (!id.split('?')[0].endsWith('.sql')) {
return null
}
return { code: `export default ${JSON.stringify(code)}`, map: null }
},
}
}