: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
fix(storybook): fix cloudflare pages build OOM and quill dep resolution (#61474)
Raúl Negrón-Otero831fd3f43162
diff --git a/common/storybook/.storybook/main.ts b/common/storybook/.storybook/main.tsindex 8c7cb7c0e372..2ded002a4d21 100644--- a/common/storybook/.storybook/main.ts+++ b/common/storybook/.storybook/main.ts@@ -33,13 +33,17 @@ const config: StorybookConfig = {{ from: '../../../frontend/node_modules/@posthog/hedgehog-mode/assets', to: '/static/hedgehog-mode' },],- webpackFinal: (config) => {+ webpackFinal: (config, { configType }) => {const mainConfig = createEntry('main')return {...config,// Disable filesystem cache in CI to avoid heap OOM during cache shutdown// (especially on memory-constrained environments like Cloudflare Pages)cache: process.env.CI ? false : { type: 'filesystem' },+ // The hosted build doesn't need source maps, and generating them is what+ // tips Terser over the heap limit during minification (webpack 5 ties+ // Terser's source maps to `devtool`). Keep them for local `storybook dev`.+ devtool: configType === 'PRODUCTION' ? false : config.devtool,plugins: [...(config.plugins ?? []), new ModuleGraphPlugin(REPO_ROOT)],resolve: {...config.resolve,diff --git a/common/storybook/package.json b/common/storybook/package.jsonindex d4f8e86e1e75..7fb124335966 100644--- a/common/storybook/package.json+++ b/common/storybook/package.json@@ -2,7 +2,7 @@"name": "@posthog/storybook","scripts": {"build:products": "pnpm --filter=@posthog/frontend build:products",- "build": "pnpm build:products && DEBUG=0 storybook build -o dist",+ "build": "pnpm build:products && DEBUG=0 NODE_OPTIONS=--max-old-space-size=6144 storybook build -o dist","start": "pnpm build:products && DEBUG=0 storybook dev -p 6006","test:visual:ci:update": "test-storybook -u --junit --no-index-json --maxWorkers=1","test:visual:ci:verify": "test-storybook --ci --junit --no-index-json --maxWorkers=1",diff --git a/packages/quill/packages/charts/package.json b/packages/quill/packages/charts/package.jsonindex a0188e4f99ce..a1ad9ad21b23 100644--- a/packages/quill/packages/charts/package.json+++ b/packages/quill/packages/charts/package.json@@ -21,6 +21,7 @@},"dependencies": {"@floating-ui/react": "^0.27.19",+ "@testing-library/dom": ">=9.3.4","d3-array": "^3.2.4","d3-color": "^3.1.0","d3-scale": "^4.0.2",@@ -30,7 +31,6 @@},"devDependencies": {"@storybook/react": "catalog:",- "@testing-library/dom": ">=9.3.4","@testing-library/react": "^14.3.1","@types/d3-array": "^3.2.1","@types/d3-color": "^3.1.3",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex c7b48dbca3f7..cf1ae426ebf4 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1890,6 +1890,9 @@ importers:'@floating-ui/react':specifier: ^0.27.19+ '@testing-library/dom':+ specifier: '>=9.3.4'+ version: 9.3.4d3-array:specifier: ^3.2.4version: 3.2.4@@ -1918,9 +1921,6 @@ importers:'@storybook/react':specifier: 'catalog:'version: 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])- '@testing-library/dom':- specifier: '>=9.3.4'- version: 9.3.4'@testing-library/react':specifier: ^14.3.1