56 lines
1.4 KiB
JavaScript
56 lines
1.4 KiB
JavaScript
import { fileURLToPath, URL } from "node:url";
|
|
import { defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import Components from "unplugin-vue-components/vite";
|
|
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
|
|
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
|
|
import path from "path";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
base: process.env.NODE_ENV === "production" ? "./" : "/",
|
|
build: {
|
|
outDir: process.env.NODE_ENV === "production" ? "../dist" : "./dist",
|
|
emptyOutDir: true,
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/upload': {
|
|
target: "https://pccv.production.mjmtech.com.tw",
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
'/login': {
|
|
target: "https://pccv.production.mjmtech.com.tw",
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
},
|
|
},
|
|
plugins: [
|
|
vue(),
|
|
Components({
|
|
resolvers: [
|
|
AntDesignVueResolver({
|
|
importStyle: false, // css in js
|
|
}),
|
|
],
|
|
}),
|
|
createSvgIconsPlugin({
|
|
iconDirs: [path.resolve(process.cwd(), "src/assets/icon")],
|
|
symbolId: "icon-[dir]-[name]",
|
|
}),
|
|
],
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {},
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
"@ASSET": fileURLToPath(new URL("./src/assets", import.meta.url)),
|
|
},
|
|
},
|
|
});
|