importers[path] is not a function error - while adding a new story when storybook config is in a sub-directory #32407
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @avinashs24! I'm Dosu and I’m helping the storybook team. This issue happens because Vite's file watcher and internal importers map don't always handle new files outside the initial scope when your Storybook config is in a sub-directory and your stories glob traverses up directories. That's why you see the A reliable workaround is to add a minimal .storybook/vite.config.ts import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
}); .storybook/main.ts framework: {
name: '@storybook/react-vite',
options: {
builder: {
viteConfigPath: '.storybook/vite.config',
},
},
}, This approach has resolved the same error for others using similar setups [discussion]. If you still have issues, double-check that your stories glob is correct and that your To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Ended up moving .storybook config to the project root