EasyTier/easytier-gui/vite.config.ts

96 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-05-05 23:10:42 +08:00
import path from 'node:path'
import process from 'node:process'
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
2024-05-05 23:10:42 +08:00
import Vue from '@vitejs/plugin-vue'
2024-10-07 15:46:49 +08:00
import autoprefixer from 'autoprefixer'
import tailwind from 'tailwindcss'
2024-05-05 23:10:42 +08:00
import AutoImport from 'unplugin-auto-import/vite'
2024-10-07 15:46:49 +08:00
import { } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
2024-05-05 23:10:42 +08:00
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'
2024-08-08 22:03:22 +08:00
const host = process.env.TAURI_DEV_HOST
2024-04-14 23:29:34 +08:00
2024-10-07 15:46:49 +08:00
export default defineConfig({
2024-05-05 23:10:42 +08:00
resolve: {
alias: {
2024-05-06 11:08:51 +08:00
'~/': `${path.resolve(__dirname, 'src')}/`,
2024-05-05 23:10:42 +08:00
},
},
2024-10-07 15:46:49 +08:00
css: {
postcss: {
plugins: [tailwind(), autoprefixer()],
},
},
2024-04-14 23:29:34 +08:00
plugins: [
2024-10-07 15:46:49 +08:00
Vue({
include: [/\.vue$/, /\.md$/],
2024-05-05 23:10:42 +08:00
}),
VueRouter({
extensions: ['.vue', '.md'],
dts: 'src/typed-router.d.ts',
}),
Layouts(),
AutoImport({
imports: [
'vue',
'vue-i18n',
'pinia',
2024-10-07 15:46:49 +08:00
'@vueuse/core',
2024-05-05 23:10:42 +08:00
VueRouterAutoImports,
{
'vue-router/auto': ['useLink'],
},
],
dts: 'src/auto-imports.d.ts',
dirs: [
'src/composables',
2024-10-07 15:46:49 +08:00
'src/components/**/**',
2024-05-05 23:10:42 +08:00
'src/stores',
2024-10-07 15:46:49 +08:00
'src/types',
'src/lib',
2024-05-05 23:10:42 +08:00
],
vueTemplate: true,
}),
2024-04-14 23:29:34 +08:00
Components({
2024-05-05 23:10:42 +08:00
extensions: ['vue', 'md'],
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
2024-10-07 15:46:49 +08:00
resolvers: [],
2024-05-05 23:10:42 +08:00
dts: 'src/components.d.ts',
}),
VueI18n({
runtimeOnly: true,
compositionOnly: true,
fullInstall: true,
include: [path.resolve(__dirname, 'locales/**')],
}),
VueDevTools(),
],
2024-04-14 23:29:34 +08:00
clearScreen: false,
server: {
2024-08-08 22:03:22 +08:00
host: host || false,
2024-10-07 15:46:49 +08:00
port: 1420,
2024-04-14 23:29:34 +08:00
strictPort: true,
2024-08-08 22:03:22 +08:00
hmr: host
? {
protocol: 'ws',
2024-10-07 15:46:49 +08:00
host,
port: 1430,
}
2024-08-08 22:03:22 +08:00
: undefined,
2024-04-14 23:29:34 +08:00
},
2024-10-07 15:46:49 +08:00
})