Skip to content

Instantly share code, notes, and snippets.

@SealtielFreak
Created June 27, 2024 00:44
Show Gist options
  • Save SealtielFreak/36008248b99c62f49881f94603c906a5 to your computer and use it in GitHub Desktop.
Save SealtielFreak/36008248b99c62f49881f94603c906a5 to your computer and use it in GitHub Desktop.
Storybook config for alias module with Vite
import type { StorybookConfig } from "@storybook/react-vite";
import { mergeConfig } from 'vite';
import path from 'path';
const config: StorybookConfig = {
stories: [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
],
addons: [
"@storybook/addon-onboarding",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/react-vite",
options: {},
},
viteFinal: async (config, { configType }) => {
console.log(__dirname);
return mergeConfig(config, {
resolve: {
alias: {
'@/components': path.resolve(__dirname, "../components"),
'@/styles': path.resolve(__dirname, "../styles"),
},
},
});
},
};
export default config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment