Files
ComfyUI_frontend/.storybook/main.mjs
snomiao b2a97ee4f0 [bugfix] Fix Storybook builder require() error by converting main.ts to main.mjs
- Convert .storybook/main.ts to main.mjs to resolve ES module compatibility
- Use dynamic imports instead of static imports to avoid require() errors
- Add .storybook directory to tsconfig.json includes
- Storybook build and dev server now work correctly

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:55:59 +00:00

48 lines
1.1 KiB
JavaScript

/** @type {import('@storybook/vue3-vite').StorybookConfig} */
const config = {
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: ['@storybook/addon-docs'],
framework: {
name: '@storybook/vue3-vite',
options: {}
},
async viteFinal(config) {
const { mergeConfig } = await import('vite')
const { fileURLToPath } = await import('url')
const path = await import('path')
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
return mergeConfig(config, {
server: {
allowedHosts: true
},
resolve: {
alias: {
'@': __dirname + '/../src'
}
},
build: {
rollupOptions: {
external: (id) => {
return false
},
onwarn: (warning, warn) => {
if (
warning.code === 'UNUSED_EXTERNAL_IMPORT' &&
warning.message?.includes('resolveComponent')
) {
return
}
warn(warning)
},
output: {}
},
chunkSizeWarningLimit: 1000
}
})
}
}
export default config