The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import type { StorybookConfig } from '@storybook/react-vite';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { createAvatarImageFixturePlugin } from '../scripts/front-component-stories/createAvatarImageFixturePlugin';
const dirname =
typeof __dirname !== 'undefined'
? __dirname
: path.dirname(fileURLToPath(import.meta.url));
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-vitest'],
framework: '@storybook/react-vite',
refs: {
'@chakra-ui/react': { disable: true },
},
staticDirs: [
{
from: '../src/__stories__/example-sources-built',
to: '/built',
},
{
from: '../src/__stories__/example-sources-built-preact',
to: '/built-preact',
},
],
viteFinal: async (viteConfig) => {
return {
...viteConfig,
plugins: [
...(viteConfig.plugins ?? []),
createAvatarImageFixturePlugin(),
],
resolve: {
...viteConfig.resolve,
tsconfigPaths: true,
alias: {
...viteConfig.resolve?.alias,
'@': path.resolve(dirname, '../src'),
// twenty-sdk has React 19 locally (for Ink 6 CLI), but
// twenty-ui's dist uses React 18 internals. Force React 18
// from the workspace root for storybook builds.
react: path.resolve(dirname, '../../../node_modules/react'),
'react-dom': path.resolve(dirname, '../../../node_modules/react-dom'),
'react/jsx-runtime': path.resolve(
dirname,
'../../../node_modules/react/jsx-runtime',
),
'react/jsx-dev-runtime': path.resolve(
dirname,
'../../../node_modules/react/jsx-dev-runtime',
),
},
},
optimizeDeps: {
...viteConfig.optimizeDeps,
include: [
...(viteConfig.optimizeDeps?.include ?? []),
'transliteration',
'@remote-dom/core/polyfill',
'@remote-dom/react/polyfill',
'@remote-dom/core/elements',
'@remote-dom/react',
'react-dom/client',
'react/jsx-runtime',
],
},
};
},
};
export default config;