mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
Prepares Vite config for Vite 8 by migrating from esbuild/Rollup to Rolldown/Oxc. ## Changes - Migrate `build.rollupOptions` → `build.rolldownOptions` - Replace `manualChunks` with `codeSplitting.groups` - Update Storybook config with `strictExecutionOrder` for module loading compatibility ## Testing - [x] `pnpm typecheck` passes - [x] `pnpm build` succeeds - [x] `pnpm test:unit` passes --------- Co-authored-by: Amp <amp@ampcode.com>
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
import tailwindcss from '@tailwindcss/vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import dotenv from 'dotenv'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
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 { defineConfig } from 'vite'
|
|
import { createHtmlPlugin } from 'vite-plugin-html'
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
|
|
dotenv.config()
|
|
|
|
const projectRoot = fileURLToPath(new URL('.', import.meta.url))
|
|
|
|
const SHOULD_MINIFY = process.env.ENABLE_MINIFY === 'true'
|
|
const VITE_REMOTE_DEV = process.env.VITE_REMOTE_DEV === 'true'
|
|
const DISABLE_VUE_PLUGINS = process.env.DISABLE_VUE_PLUGINS === 'true'
|
|
|
|
export default defineConfig(() => {
|
|
return {
|
|
root: projectRoot,
|
|
base: '',
|
|
publicDir: path.resolve(projectRoot, 'public'),
|
|
server: {
|
|
port: 5174,
|
|
host: VITE_REMOTE_DEV ? '0.0.0.0' : undefined
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(projectRoot, 'src'),
|
|
'@frontend-locales': path.resolve(projectRoot, '../../src/locales')
|
|
}
|
|
},
|
|
plugins: [
|
|
...(!DISABLE_VUE_PLUGINS
|
|
? [vueDevTools(), vue(), createHtmlPlugin({})]
|
|
: [vue()]),
|
|
tailwindcss(),
|
|
Icons({
|
|
compiler: 'vue3',
|
|
customCollections: {
|
|
comfy: FileSystemIconLoader(
|
|
path.resolve(projectRoot, '../../packages/design-system/src/icons')
|
|
)
|
|
}
|
|
}),
|
|
Components({
|
|
dts: path.resolve(projectRoot, 'components.d.ts'),
|
|
resolvers: [
|
|
IconsResolver({
|
|
customCollections: ['comfy']
|
|
})
|
|
],
|
|
dirs: [
|
|
path.resolve(projectRoot, 'src/components'),
|
|
path.resolve(projectRoot, 'src/views')
|
|
],
|
|
deep: true,
|
|
extensions: ['vue'],
|
|
directoryAsNamespace: true
|
|
})
|
|
],
|
|
build: {
|
|
minify: SHOULD_MINIFY,
|
|
target: 'es2022',
|
|
sourcemap: true
|
|
}
|
|
}
|
|
})
|