|
@@ -1,73 +1,77 @@
|
|
|
-import { defineConfig } from "vite";
|
|
|
+import { defineConfig ,loadEnv} from "vite";
|
|
|
import vue from "@vitejs/plugin-vue";
|
|
|
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
|
|
|
|
|
|
import { resolve } from "path";
|
|
|
|
|
|
+
|
|
|
function pathResolve(dir) {
|
|
|
return resolve(process.cwd(), ".", dir);
|
|
|
}
|
|
|
|
|
|
-export default defineConfig({
|
|
|
- resolve: {
|
|
|
- alias: [{
|
|
|
- find: "@",
|
|
|
- replacement: pathResolve("src"),
|
|
|
- }, ],
|
|
|
- dedupe: ["vue"],
|
|
|
- },
|
|
|
- plugins: [
|
|
|
- vue(),
|
|
|
- createSvgIconsPlugin({
|
|
|
-
|
|
|
- iconDirs: [resolve(process.cwd(), "src/assets/svg")],
|
|
|
-
|
|
|
- symbolId: "icon-[dir]-[name]",
|
|
|
- }),
|
|
|
- ],
|
|
|
- css: {
|
|
|
-
|
|
|
- preprocessorOptions: {
|
|
|
- less: {
|
|
|
- charset: false,
|
|
|
- modifyVars: {
|
|
|
- "arcoblue-6": "#d1402f",
|
|
|
+export default defineConfig(({command, mode})=>{
|
|
|
+ const config = loadEnv(mode,'./')
|
|
|
+ return {
|
|
|
+ resolve: {
|
|
|
+ alias: [{
|
|
|
+ find: "@",
|
|
|
+ replacement: pathResolve("src"),
|
|
|
+ }, ],
|
|
|
+ dedupe: ["vue"],
|
|
|
+ },
|
|
|
+ plugins: [
|
|
|
+ vue(),
|
|
|
+ createSvgIconsPlugin({
|
|
|
+
|
|
|
+ iconDirs: [resolve(process.cwd(), "src/assets/svg")],
|
|
|
+
|
|
|
+ symbolId: "icon-[dir]-[name]",
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ css: {
|
|
|
+
|
|
|
+ preprocessorOptions: {
|
|
|
+ less: {
|
|
|
+ charset: false,
|
|
|
+ modifyVars: {
|
|
|
+ "arcoblue-6": "#d1402f",
|
|
|
+ },
|
|
|
+ javascriptEnabled: true,
|
|
|
+ additionalData: '@import "@/assets/css/theme.less";@import "@/assets/css/global.less";',
|
|
|
},
|
|
|
- javascriptEnabled: true,
|
|
|
- additionalData: '@import "@/assets/css/theme.less";@import "@/assets/css/global.less";',
|
|
|
},
|
|
|
},
|
|
|
- },
|
|
|
- build: {
|
|
|
- minify: true,
|
|
|
- target: "es2015",
|
|
|
-
|
|
|
- chunkSizeWarningLimit: 5000,
|
|
|
- rollupOptions: {
|
|
|
- external: [],
|
|
|
-
|
|
|
- output: {
|
|
|
- chunkFileNames: "static/js/[name]-[hash].js",
|
|
|
- entryFileNames: "static/js/[name]-[hash].js",
|
|
|
- assetFileNames: "static/[ext]/[name]-[hash].[ext]",
|
|
|
+ build: {
|
|
|
+ minify: true,
|
|
|
+ target: "es2015",
|
|
|
+
|
|
|
+ chunkSizeWarningLimit: 5000,
|
|
|
+ rollupOptions: {
|
|
|
+ external: [],
|
|
|
+
|
|
|
+ output: {
|
|
|
+ chunkFileNames: "static/js/[name]-[hash].js",
|
|
|
+ entryFileNames: "static/js/[name]-[hash].js",
|
|
|
+ assetFileNames: "static/[ext]/[name]-[hash].[ext]",
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
- },
|
|
|
- server: {
|
|
|
- port: 8088,
|
|
|
- host: "0.0.0.0",
|
|
|
- open: true,
|
|
|
- cors: true,
|
|
|
- hmr: true,
|
|
|
- proxy: {
|
|
|
- "/api": {
|
|
|
-
|
|
|
- target: import.meta.env.VITE_API_URL,
|
|
|
-
|
|
|
- changeOrigin: true,
|
|
|
- ws: true,
|
|
|
- secure: true,
|
|
|
+ server: {
|
|
|
+ port: 8088,
|
|
|
+ host: "0.0.0.0",
|
|
|
+ open: true,
|
|
|
+ cors: true,
|
|
|
+ hmr: true,
|
|
|
+ proxy: {
|
|
|
+ "/api": {
|
|
|
+
|
|
|
+ target: config.VITE_API_URL,
|
|
|
+
|
|
|
+ changeOrigin: true,
|
|
|
+ ws: true,
|
|
|
+ secure: true,
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
- },
|
|
|
+ }
|
|
|
});
|