Files
ComfyUI_frontend/.storybook/main.ts
snomiao ac37a5e375 [feat] Rebase branch onto main and update Storybook configuration
- Rebase sno-storybook branch onto origin/main with latest changes
- Update .storybook/main.ts with additional plugins and component configuration
- Add icons and component resolvers for Storybook support
- Update .gitignore with new entries
- Regenerate package-lock.json after rebase conflicts

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

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

79 lines
2.1 KiB
TypeScript

import type { StorybookConfig } from '@storybook/vue3-vite'
import path from 'path'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
import IconsResolver from 'unplugin-icons/resolver'
import Icons from 'unplugin-icons/vite'
import Components from 'unplugin-vue-components/vite'
import { fileURLToPath } from 'url'
import { type InlineConfig, mergeConfig } from 'vite'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: ['@storybook/addon-docs'],
framework: {
name: '@storybook/vue3-vite',
options: {}
},
async viteFinal(config) {
return mergeConfig(config, {
plugins: [
Icons({
compiler: 'vue3',
customCollections: {
comfy: FileSystemIconLoader(
__dirname + '/../src/assets/icons/custom'
)
}
}),
Components({
dts: false, // Disable dts generation in Storybook
resolvers: [
IconsResolver({
customCollections: ['comfy']
})
],
dirs: [
__dirname + '/../src/components',
__dirname + '/../src/layout',
__dirname + '/../src/views'
],
deep: true,
extensions: ['vue']
})
],
server: {
allowedHosts: true
},
resolve: {
alias: {
'@': __dirname + '/../src'
}
},
build: {
rollupOptions: {
external: (id) => {
// Suppress warnings for unused Vue internal imports
return false
},
onwarn: (warning, warn) => {
// Suppress specific warnings
if (
warning.code === 'UNUSED_EXTERNAL_IMPORT' &&
warning.message?.includes('resolveComponent')
) {
return
}
warn(warning)
},
output: {}
},
chunkSizeWarningLimit: 1000
}
} satisfies InlineConfig)
}
}
export default config