Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(storybook): set modern esbuild target for dev dependency pre-bundling (#3117)

Lachlan Bradfordc744e8a36d5f
diff --git a/apps/storybook/.storybook/main.ts b/apps/storybook/.storybook/main.ts
index 1419fdcb0b..876c6ff0b7 100644
--- a/apps/storybook/.storybook/main.ts
+++ b/apps/storybook/.storybook/main.ts
@@ -44,9 +44,8 @@ const config: StorybookConfig = {
...config,
build: {
...config.build,
- // Storybook's generated story chunks use hook tuple destructuring.
- // esbuild 0.28 cannot downlevel those chunks for Vite's default
- // Safari 14 baseline, so match the modern preview CSS targets.
+ // esbuild will not downlevel syntax such as destructuring — target modern
+ // browsers only.
target: viteBuildTargets,
},
optimizeDeps: {
@@ -55,6 +54,12 @@ const config: StorybookConfig = {
// pre-bundled deps. The StyleX Babel plugin stalls on some XDS core
// components, so the crawl never completes and deps are never served.
holdUntilCrawlEnd: false,
+ esbuildOptions: {
+ ...config.optimizeDeps?.esbuildOptions,
+ // esbuild will not downlevel syntax such as destructuring — target modern
+ // browsers only.
+ target: viteBuildTargets,
+ },
},
plugins: [
{