You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
3.0 KiB
94 lines
3.0 KiB
import { resolve } from "path"
|
|
import { defineConfig, externalizeDepsPlugin } from "electron-vite"
|
|
import vue from "@vitejs/plugin-vue"
|
|
import vueJsx from "@vitejs/plugin-vue-jsx"
|
|
import UnoCSS from "unocss/vite"
|
|
import AutoImport from "unplugin-auto-import/vite"
|
|
import Components from "unplugin-vue-components/vite"
|
|
import VueMacros from "unplugin-vue-macros/vite"
|
|
import { VueRouterAutoImports } from "unplugin-vue-router"
|
|
import VueRouter from "unplugin-vue-router/vite"
|
|
import Layouts from "vite-plugin-vue-layouts"
|
|
|
|
export default defineConfig({
|
|
main: {
|
|
resolve: {
|
|
alias: {
|
|
config: resolve("config"),
|
|
main: resolve("src/main"),
|
|
res: resolve("resources"),
|
|
},
|
|
},
|
|
plugins: [externalizeDepsPlugin()],
|
|
},
|
|
preload: {
|
|
plugins: [externalizeDepsPlugin()],
|
|
},
|
|
renderer: {
|
|
root: resolve(__dirname, "./src/renderer"),
|
|
resolve: {
|
|
alias: {
|
|
config: resolve("config"),
|
|
"@": resolve("src/renderer/src"),
|
|
"@res": resolve("resources"),
|
|
},
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
additionalData: `@use "@/assets/style/global" as *;\n`,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
main: resolve(__dirname, "./src/renderer/index.html"),
|
|
about: resolve(__dirname, "./src/renderer/about.html"),
|
|
},
|
|
},
|
|
},
|
|
plugins: [
|
|
UnoCSS(),
|
|
VueMacros({
|
|
plugins: {
|
|
vue: vue(),
|
|
vueJsx: vueJsx(),
|
|
vueRouter: VueRouter({
|
|
root: resolve(__dirname, "src/renderer"),
|
|
// https://github.com/posva/unplugin-vue-router
|
|
extensions: [".vue", ".setup.tsx"],
|
|
exclude: ["**/_ui"],
|
|
}),
|
|
},
|
|
}),
|
|
Layouts({
|
|
layoutsDirs: "src/layouts",
|
|
pagesDirs: "src/pages",
|
|
defaultLayout: "default",
|
|
extensions: ["vue", "setup.tsx"],
|
|
exclude: ["**/_ui"],
|
|
}),
|
|
// https://github.com/antfu/unplugin-auto-import
|
|
AutoImport({
|
|
imports: [
|
|
"vue",
|
|
"@vueuse/core",
|
|
VueRouterAutoImports,
|
|
{
|
|
// add any other imports you were relying on
|
|
"vue-router/auto": ["useLink"],
|
|
},
|
|
],
|
|
dts: true,
|
|
dirs: ["src/composables"],
|
|
vueTemplate: true,
|
|
}),
|
|
// https://github.com/antfu/vite-plugin-components
|
|
Components({
|
|
dts: true,
|
|
dirs: ["src/components"],
|
|
}),
|
|
],
|
|
},
|
|
})
|
|
|