Hello there, I'm getting this error only when I build storybook.
Error: [vite]: Rollup failed to resolve import "@components/Spinner" from "src/components/Button.tsx".
What does it mean? What I have to do? my vite config, tsconfig and main.cjs of storybook have the alias.
my vite config
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@images': path.resolve(__dirname, './public/images'),
'@services': path.resolve(__dirname, './src/services'),
'@utils': path.resolve(__dirname, './src/utils'),
'@components': path.resolve(__dirname, './src/components'),
'@styles': path.resolve(__dirname, './src/styles'),
'@screens': path.resolve(__dirname, './src/screens'),
'@hooks': path.resolve(__dirname, './src/hooks'),
'@contexts': path.resolve(__dirname, './src/contexts'),
'@assets': path.resolve(__dirname, './src/assets'),
'@locales': path.resolve(__dirname, './src/locales/'),
},
},
plugins: [reactSvgPlugin(), react()],
});
storybook config
webpackFinal: async (config) => ({
...config,
resolve: {
...config.resolve,
alias: {
...config.resolve?.alias,
'@images': path.resolve(__dirname, './public/images'),
'@services': path.resolve(__dirname, './src/services'),
'@utils': path.resolve(__dirname, './src/utils'),
'@components': path.resolve(__dirname, './src/components'),
'@styles': path.resolve(__dirname, './src/styles'),
'@screens': path.resolve(__dirname, './src/screens'),
'@hooks': path.resolve(__dirname, './src/hooks'),
'@contexts': path.resolve(__dirname, './src/contexts'),
'@assets': path.resolve(__dirname, './src/assets'),
'@locales': path.resolve(__dirname, './src/locales/'),
},
},
}),
Thanks