Skip to content

Commit

Permalink
fix: chromatic builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Niznikr committed Dec 5, 2023
1 parent c7a7370 commit e66e7a3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { StorybookConfig } from '@storybook/react-vite';
import path from 'path';
import fs from 'fs';
import fg from 'fast-glob';
import stylexPlugin from '@stylexjs/rollup-plugin';
import turbosnap from 'vite-plugin-turbosnap';

import tsconfig from '../tsconfig.json';
Expand Down Expand Up @@ -49,6 +50,15 @@ const config: StorybookConfig = {
async viteFinal(config, { configType }) {
if (configType === 'PRODUCTION') {
config.plugins?.push(turbosnap({ rootDir: config.root || process.cwd() }));
config.build!.rollupOptions!.plugins = [
stylexPlugin({
// Required for CSS variable support
unstable_moduleResolution: {
type: 'commonJS',
rootDir: __dirname,
},
}),
];
}

return config;
Expand All @@ -57,6 +67,10 @@ const config: StorybookConfig = {
autodocs: true,
defaultName: 'Docs',
},
previewHead: (head) => `
${head}
${process.env.NODE_ENV === 'production' ? '<link href="./stylex.css" rel="stylesheet" />' : ''}
`,
};

const getPackageStatusEnvVars = () => {
Expand Down

0 comments on commit e66e7a3

Please sign in to comment.