Created
June 27, 2024 00:44
-
-
Save SealtielFreak/36008248b99c62f49881f94603c906a5 to your computer and use it in GitHub Desktop.
Storybook config for alias module with Vite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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