import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; import type { StorybookConfig } from '@storybook/web-components-vite'; import { mergeConfig } from 'vite'; // These options were migrated by @nx/storybook:convert-to-inferred from the project.json file. const configValues = { default: {}, ci: {} }; // Determine the correct configValue to use based on the configuration const nxConfiguration = process.env.NX_TASK_TARGET_CONFIGURATION ?? 'default'; const options = { ...configValues.default, ...(configValues[nxConfiguration] ?? {}), }; const config: StorybookConfig = { stories: ['../src/lib/*.stories.@(js|jsx|ts|tsx|mdx)'], addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'], framework: { name: '@storybook/web-components-vite', options: {}, }, viteFinal: async (config) => mergeConfig(config, { plugins: [nxViteTsPaths()], }), }; export default config; // To customize your Vite configuration you can use the viteFinal field. // Check https://storybook.js.org/docs/react/builders/vite#configuration // and https://nx.dev/recipes/storybook/custom-builder-configs