|
@@ -1,118 +1,122 @@
|
|
|
-import {defineConfig, loadEnv} from "vite";
|
|
|
+import { defineConfig, loadEnv } from "vite";
|
|
|
import vue from "@vitejs/plugin-vue";
|
|
|
-import {resolve} from "path";
|
|
|
+import { resolve } from "path";
|
|
|
// vue setup 的糖语法
|
|
|
import VueSetupExtend from "vite-plugin-vue-setup-extend";
|
|
|
// 不用导入 vue 的 import 了
|
|
|
import AutoImport from "unplugin-auto-import/vite";
|
|
|
import Icons from "unplugin-icons/vite";
|
|
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
|
-import {createHtmlPlugin} from "vite-plugin-html";
|
|
|
+import { createHtmlPlugin } from "vite-plugin-html";
|
|
|
import pkg from "./package.json";
|
|
|
|
|
|
const pathResolve = dir => {
|
|
|
- return resolve(__dirname, ".", dir);
|
|
|
+ return resolve(__dirname, ".", dir);
|
|
|
};
|
|
|
|
|
|
const alias = {
|
|
|
- "@": pathResolve("src"),
|
|
|
+ "@": pathResolve("src"),
|
|
|
};
|
|
|
|
|
|
-export default defineConfig(({mode}) => {
|
|
|
- const ENV = loadEnv(mode, process.cwd());
|
|
|
- const GLOB_CONFIG_FILE_NAME = "_app.config.js";
|
|
|
+export default defineConfig(({ mode }) => {
|
|
|
+ const ENV = loadEnv(mode, process.cwd());
|
|
|
+ const GLOB_CONFIG_FILE_NAME = "_app.config.js";
|
|
|
|
|
|
- const isBuild = mode === "production";
|
|
|
- const getAppConfigSrc = () => {
|
|
|
- return `/${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`;
|
|
|
- };
|
|
|
+ const isBuild = mode === "production";
|
|
|
+ const getAppConfigSrc = () => {
|
|
|
+ return `/${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`;
|
|
|
+ };
|
|
|
|
|
|
- return {
|
|
|
- define: {
|
|
|
- __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "true",
|
|
|
- },
|
|
|
- esbuild: {
|
|
|
- jsxFactory: "h",
|
|
|
- jsxFragment: "Fragment",
|
|
|
- },
|
|
|
- externals: {
|
|
|
- BMap: "BMap",
|
|
|
- BMapLib: "BMapLib",
|
|
|
+ return {
|
|
|
+ define: {
|
|
|
+ __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "true",
|
|
|
+ },
|
|
|
+ esbuild: {
|
|
|
+ jsxFactory: "h",
|
|
|
+ jsxFragment: "Fragment",
|
|
|
+ },
|
|
|
+ externals: {
|
|
|
+ BMap: "BMap",
|
|
|
+ BMapLib: "BMapLib",
|
|
|
+ },
|
|
|
+ resolve: {
|
|
|
+ alias,
|
|
|
+ extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
|
|
|
+ },
|
|
|
+ plugins: [
|
|
|
+ Icons({
|
|
|
+ autoInstall: true,
|
|
|
+ compiler: "vue3",
|
|
|
+ }),
|
|
|
+ VueSetupExtend({ name: false }),
|
|
|
+ vue(),
|
|
|
+ vueJsx(),
|
|
|
+ AutoImport({
|
|
|
+ dts: "src/auto-imports.d.ts",
|
|
|
+ imports: ["vue"],
|
|
|
+ }),
|
|
|
+ createHtmlPlugin({
|
|
|
+ minify: isBuild,
|
|
|
+ inject: {
|
|
|
+ data: {
|
|
|
+ title: "",
|
|
|
+ },
|
|
|
+ // Embed the generated app.config.js file
|
|
|
+ tags: isBuild
|
|
|
+ ? [
|
|
|
+ {
|
|
|
+ tag: "script",
|
|
|
+ attrs: {
|
|
|
+ src: getAppConfigSrc(),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ : [],
|
|
|
},
|
|
|
- resolve: {
|
|
|
- alias,
|
|
|
- extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ server: {
|
|
|
+ host: "0.0.0.0",
|
|
|
+ port: 3000,
|
|
|
+ proxy: {
|
|
|
+ "/emr": {
|
|
|
+ //这里配置运行时服务地址
|
|
|
+ target: "http://172.16.32.125:8001/emr",
|
|
|
+ secure: false, //如果运行时服务是https,此处配置为true
|
|
|
+ changeOrigin: true, //支持跨域调用,这里配置为true
|
|
|
+ rewrite: path => path.replace(/^\/emr/, ""),
|
|
|
},
|
|
|
- plugins: [
|
|
|
- Icons({
|
|
|
- autoInstall: true,
|
|
|
- compiler: "vue3",
|
|
|
- }),
|
|
|
- VueSetupExtend({name: false}),
|
|
|
- vue(),
|
|
|
- vueJsx(),
|
|
|
- AutoImport({
|
|
|
- dts: "src/auto-imports.d.ts",
|
|
|
- imports: ["vue"],
|
|
|
- }),
|
|
|
- createHtmlPlugin({
|
|
|
- minify: isBuild,
|
|
|
- inject: {
|
|
|
- data: {
|
|
|
- title: "",
|
|
|
- },
|
|
|
- // Embed the generated app.config.js file
|
|
|
- tags: isBuild
|
|
|
- ? [
|
|
|
- {
|
|
|
- tag: "script",
|
|
|
- attrs: {
|
|
|
- src: getAppConfigSrc(),
|
|
|
- },
|
|
|
- },
|
|
|
- ]
|
|
|
- : [],
|
|
|
- },
|
|
|
- }),
|
|
|
- ],
|
|
|
- server: {
|
|
|
- host: "0.0.0.0",
|
|
|
- port: 3000,
|
|
|
- proxy: {
|
|
|
- "/emr": {
|
|
|
- //这里配置运行时服务地址
|
|
|
- target: "http://172.16.32.125:8001/emr",
|
|
|
- secure: false, //如果运行时服务是https,此处配置为true
|
|
|
- changeOrigin: true, //支持跨域调用,这里配置为true
|
|
|
- rewrite: path => path.replace(/^\/emr/, ""),
|
|
|
- },
|
|
|
- "/doctorSignatureImage": {
|
|
|
- target: "http://172.16.32.167:8077",
|
|
|
- secure: false, //如果运行时服务是https,此处配置为true
|
|
|
- changeOrigin: true, //支持跨域调用,这里配置为true
|
|
|
- },
|
|
|
- "/thyyarchive": {
|
|
|
- target: "http://172.16.32.197:9202/",
|
|
|
- secure: false,
|
|
|
- changeOrigin: true,
|
|
|
- rewrite: path => path.replace(/^\/thyyarchive/, ""),
|
|
|
- },
|
|
|
- },
|
|
|
+ "/doctorSignatureImage": {
|
|
|
+ target: "http://172.16.32.167:8077",
|
|
|
+ secure: false, //如果运行时服务是https,此处配置为true
|
|
|
+ changeOrigin: true, //支持跨域调用,这里配置为true
|
|
|
},
|
|
|
- build: {
|
|
|
- chunkSizeWarningLimit: 1000,
|
|
|
- outDir: "release/dist",
|
|
|
- rollupOptions: {
|
|
|
- output: {
|
|
|
- // monaco-editor-DPcKYIc8.js
|
|
|
- manualChunks(id) {
|
|
|
- if (id.includes('node_modules')) {
|
|
|
- return id.toString().split('node_modules/')[1].split('/')[0].toString();
|
|
|
- }
|
|
|
- return null;
|
|
|
- },
|
|
|
- }
|
|
|
- }
|
|
|
+ "/thyyarchive": {
|
|
|
+ target: "http://172.16.32.197:9202/",
|
|
|
+ secure: false,
|
|
|
+ changeOrigin: true,
|
|
|
+ rewrite: path => path.replace(/^\/thyyarchive/, ""),
|
|
|
},
|
|
|
- };
|
|
|
+ },
|
|
|
+ },
|
|
|
+ build: {
|
|
|
+ chunkSizeWarningLimit: 1000,
|
|
|
+ outDir: "release/dist",
|
|
|
+ // 优化打包把第三方的东西每次打包时都不重复
|
|
|
+ // rollupOptions: {
|
|
|
+ // output: {
|
|
|
+ // manualChunks(id) {
|
|
|
+ // if (id.includes("node_modules")) {
|
|
|
+ // return id
|
|
|
+ // .toString()
|
|
|
+ // .split("node_modules/")[1]
|
|
|
+ // .split("/")[0]
|
|
|
+ // .toString();
|
|
|
+ // }
|
|
|
+ // return null;
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ };
|
|
|
});
|