From f68fa3bc5fc0a286c88d82ee6eb95e8ad6be0d16 Mon Sep 17 00:00:00 2001 From: qinxianzhangyao <11053546+qinxianzhangyao@user.noreply.gitee.com> Date: 星期四, 27 六月 2024 15:21:55 +0800 Subject: [PATCH] qxtj --- .gitignore | 1 vue.config.js | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 153 insertions(+), 1 deletions(-) diff --git a/.gitignore b/.gitignore index 29d56be..78a752d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,5 +20,4 @@ *.local package-lock.json -vue.config.js yarn.lock diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..e6d5c1c --- /dev/null +++ b/vue.config.js @@ -0,0 +1,153 @@ +"use strict"; +const path = require("path"); + +function resolve(dir) { + return path.join(__dirname, dir); +} + +const CompressionPlugin = require("compression-webpack-plugin"); + +const name = process.env.VUE_APP_TITLE || "鏅烘収鍋ュ悍浣撴绠$悊绯荤粺"; // 缃戦〉鏍囬 + +const port = process.env.port || process.env.npm_config_port || 80; // 绔彛 + +// vue.config.js 閰嶇疆璇存槑 +//瀹樻柟vue.config.js 鍙傝�冩枃妗� https://cli.vuejs.org/zh/config/#css-loaderoptions +// 杩欓噷鍙垪涓�閮ㄥ垎锛屽叿浣撻厤缃弬鑰冩枃妗� +module.exports = { + transpileDependencies: ["vue-json-excel"], //杩欓噷鏄皢寮曠敤鐨勬彃浠惰浆鎴恊s5锛屽叿浣撹浆鍝釜 鐪嬫祻瑙堝櫒鎺у埗鍙板摢涓姤閿欏氨濂戒簡 + // pages: { + // index: { + // // add here ---start--- + + // entry: ["node_modules/@babel/polyfill/dist/polyfill.js", "src/main.js"], //杩欓噷鐨勮矾鍔蹭竴瀹氳鍐欒嚜宸辩殑锛屽師浣滆�呯殑璺緞涓庢垜鐨勪笉鍚� + + // // add here ---end--- + + // template: "public/index.html", + + // filename: "index.html", + + // chunks: ["chunk-vendors", "chunk-common", "index"], + // }, + // }, + + // 閮ㄧ讲鐢熶骇鐜鍜屽紑鍙戠幆澧冧笅鐨刄RL銆� + // 榛樿鎯呭喌涓嬶紝Vue CLI 浼氬亣璁句綘鐨勫簲鐢ㄦ槸琚儴缃插湪涓�涓煙鍚嶇殑鏍硅矾寰勪笂 + // 渚嬪 https://www.ruoyi.vip/銆傚鏋滃簲鐢ㄨ閮ㄧ讲鍦ㄤ竴涓瓙璺緞涓婏紝浣犲氨闇�瑕佺敤杩欎釜閫夐」鎸囧畾杩欎釜瀛愯矾寰勩�備緥濡傦紝濡傛灉浣犵殑搴旂敤琚儴缃插湪 https://www.ruoyi.vip/admin/锛屽垯璁剧疆 baseUrl 涓� /admin/銆� + publicPath: process.env.NODE_ENV === "production" ? "/" : "/", + // 鍦╪pm run build 鎴� yarn build 鏃� 锛岀敓鎴愭枃浠剁殑鐩綍鍚嶇О锛堣鍜宐aseUrl鐨勭敓浜х幆澧冭矾寰勪竴鑷达級锛堥粯璁ist锛� + outputDir: "dist", + // 鐢ㄤ簬鏀剧疆鐢熸垚鐨勯潤鎬佽祫婧� (js銆乧ss銆乮mg銆乫onts) 鐨勶紱锛堥」鐩墦鍖呬箣鍚庯紝闈欐�佽祫婧愪細鏀惧湪杩欎釜鏂囦欢澶逛笅锛� + assetsDir: "static", + // 鏄惁寮�鍚痚slint淇濆瓨妫�娴嬶紝鏈夋晥鍊硷細ture | false | 'error' + lintOnSave: process.env.NODE_ENV === "development", + // 濡傛灉浣犱笉闇�瑕佺敓浜х幆澧冪殑 source map锛屽彲浠ュ皢鍏惰缃负 false 浠ュ姞閫熺敓浜х幆澧冩瀯寤恒�� + productionSourceMap: false, + // webpack-dev-server 鐩稿叧閰嶇疆 + devServer: { + host: "0.0.0.0", + port: port, + open: true, + proxy: { + // detail: https://cli.vuejs.org/config/#devserver-proxy + [process.env.VUE_APP_BASE_API]: { + // target: `https://ltpeis.xaltjdkj.cn:5801/`, + target: `http://192.168.1.3:5011`, + // // target: `http://192.168.0.99:8080/ltkj-admin`, + // target: `https://ltpeis.xaltjdkj.cn:5011/ltkj-admin`, + // target: `http://10.168.0.9:5011`, + changeOrigin: true, + pathRewrite: { + ["^" + process.env.VUE_APP_BASE_API]: "", + }, + }, + }, + disableHostCheck: true, + }, + css: { + extract: false, + loaderOptions: { + sass: { + sassOptions: { outputStyle: "expanded" }, + }, + }, + }, + configureWebpack: { + name: name, + resolve: { + alias: { + "@": resolve("src"), + }, + }, + plugins: [ + // http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#浣跨敤gzip瑙e帇缂╅潤鎬佹枃浠� + new CompressionPlugin({ + cache: false, // 涓嶅惎鐢ㄦ枃浠剁紦瀛� + test: /\.(js|css|html)?$/i, // 鍘嬬缉鏂囦欢鏍煎紡 + filename: "[path].gz[query]", // 鍘嬬缉鍚庣殑鏂囦欢鍚� + algorithm: "gzip", // 浣跨敤gzip鍘嬬缉 + minRatio: 0.8, // 鍘嬬缉鐜囧皬浜�1鎵嶄細鍘嬬缉 + }), + ], + }, + chainWebpack(config) { + config.plugins.delete("preload"); // TODO: need test + config.plugins.delete("prefetch"); // TODO: need test + + // set svg-sprite-loader + config.module.rule("svg").exclude.add(resolve("src/assets/icons")).end(); + config.module + .rule("icons") + .test(/\.svg$/) + .include.add(resolve("src/assets/icons")) + .end() + .use("svg-sprite-loader") + .loader("svg-sprite-loader") + .options({ + symbolId: "icon-[name]", + }) + .end(); + + config.when(process.env.NODE_ENV !== "development", (config) => { + config + .plugin("ScriptExtHtmlWebpackPlugin") + .after("html") + .use("script-ext-html-webpack-plugin", [ + { + // `runtime` must same as runtimeChunk name. default is `runtime` + inline: /runtime\..*\.js$/, + }, + ]) + .end(); + config.optimization.splitChunks({ + chunks: "all", + cacheGroups: { + libs: { + name: "chunk-libs", + test: /[\\/]node_modules[\\/]/, + priority: 10, + chunks: "initial", // only package third parties that are initially dependent + }, + elementUI: { + name: "chunk-elementUI", // split elementUI into a single package + priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app + test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm + }, + commons: { + name: "chunk-commons", + test: resolve("src/components"), // can customize your rules + minChunks: 3, // minimum common number + priority: 5, + reuseExistingChunk: true, + }, + }, + }); + config.optimization.runtimeChunk("single"), + { + from: path.resolve(__dirname, "./public/robots.txt"), //闃茬埇铏枃浠� + to: "./", //鍒版牴鐩綍涓� + }; + }); + }, +}; -- Gitblit v1.8.0