Skip to content

Commit c26bf43

Browse files
feat(apollo-wind): enable react compiler in storybook
Add @vitejs/plugin-react with babel-plugin-react-compiler to Storybook's Vite config so react-scan profiling reflects real compiled component performance. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 68dec70 commit c26bf43

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

packages/apollo-wind/.storybook/main.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ const config: StorybookConfig = {
5050
: undefined,
5151

5252
async viteFinal(config) {
53+
// Enable React Compiler in Storybook so react-scan reflects real perf.
54+
// Adds Babel overhead to HMR — disable with STORYBOOK_REACT_COMPILER=false
55+
if (process.env.STORYBOOK_REACT_COMPILER !== 'false') {
56+
const react = await import('@vitejs/plugin-react');
57+
config.plugins?.push(
58+
react.default({
59+
babel: {
60+
plugins: ['babel-plugin-react-compiler'],
61+
},
62+
})
63+
);
64+
}
65+
5366
return {
5467
...config,
5568
resolve: {

packages/apollo-wind/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
"@types/node": "^24.10.1",
115115
"@types/react": "^19.2.6",
116116
"@types/react-dom": "^19.2.2",
117+
"@vitejs/plugin-react": "^4.7.0",
117118
"@vitest/coverage-v8": "^4.0.14",
118119
"@vitest/ui": "^4.0.14",
119120
"ajv": "^8.17.1",

pnpm-lock.yaml

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)