EasyTier/easytier-gui/vite.config.ts
2024-10-07 15:46:49 +08:00

96 lines
2.0 KiB
TypeScript

import path from 'node:path'
import process from 'node:process'
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
import Vue from '@vitejs/plugin-vue'
import autoprefixer from 'autoprefixer'
import tailwind from 'tailwindcss'
import AutoImport from 'unplugin-auto-import/vite'
import { } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
import { VueRouterAutoImports } from 'unplugin-vue-router'
import VueRouter from 'unplugin-vue-router/vite'
import { defineConfig } from 'vite'
import VueDevTools from 'vite-plugin-vue-devtools'
import Layouts from 'vite-plugin-vue-layouts'
const host = process.env.TAURI_DEV_HOST
export default defineConfig({
resolve: {
alias: {
'~/': `${path.resolve(__dirname, 'src')}/`,
},
},
css: {
postcss: {
plugins: [tailwind(), autoprefixer()],
},
},
plugins: [
Vue({
include: [/\.vue$/, /\.md$/],
}),
VueRouter({
extensions: ['.vue', '.md'],
dts: 'src/typed-router.d.ts',
}),
Layouts(),
AutoImport({
imports: [
'vue',
'vue-i18n',
'pinia',
'@vueuse/core',
VueRouterAutoImports,
{
'vue-router/auto': ['useLink'],
},
],
dts: 'src/auto-imports.d.ts',
dirs: [
'src/composables',
'src/components/**/**',
'src/stores',
'src/types',
'src/lib',
],
vueTemplate: true,
}),
Components({
extensions: ['vue', 'md'],
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
resolvers: [],
dts: 'src/components.d.ts',
}),
VueI18n({
runtimeOnly: true,
compositionOnly: true,
fullInstall: true,
include: [path.resolve(__dirname, 'locales/**')],
}),
VueDevTools(),
],
clearScreen: false,
server: {
host: host || false,
port: 1420,
strictPort: true,
hmr: host
? {
protocol: 'ws',
host,
port: 1430,
}
: undefined,
},
})