Repository navigation
SummaryI am using the latest version of storybook 10.0.8. This error occurs after running
--- main.ts `import {fileURLToPath} from 'node:url'; function getAbsolutePath(value: string): string { const config = { export default config;` --- tsconfig.json `{ }, What is wrong with me?) Additional informationNo response Create a reproductionNo response |
Replies: 1 comment
|
Hi @kas0189! I'm Dosu and I’m helping the storybook team. The error happens because Storybook 10.x expects addon and builder names as plain strings, not resolved paths. Wrapping them with getAbsolutePath or import.meta.resolve causes Storybook to try importing a directory, which triggers the "ERR_UNSUPPORTED_DIR_IMPORT" error details. To fix it, update your import type { StorybookConfig } from '@storybook/react-vite';
const config: StorybookConfig = {
framework: {
name: '@storybook/react-vite',
options: {
builder: {
viteConfigPath: '.storybook/vite.config.js'
}
}
},
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-docs',
'@storybook/addon-onboarding',
'@storybook/addon-links',
'@chromatic-com/storybook'
]
};
export default config;You do not need to resolve the builder path manually—just use the package name as a string. Only use import.meta.resolve or fileURLToPath if you have a very custom setup, which is rare reference. Your You can try these steps and Storybook should start without the directory import error. If you still see issues, please share a minimal reproduction. To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Hi @kas0189! I'm Dosu and I’m helping the storybook team.
The error happens because Storybook 10.x expects addon and builder names as plain strings, not resolved paths. Wrapping them with getAbsolutePath or import.meta.resolve causes Storybook to try importing a directory, which triggers the "ERR_UNSUPPORTED_DIR_IMPORT" error details.
To fix it, update your
.storybook/main.tslike this: