From 1695fcd442fe2cefb6d3b63869ad8a72ebd5210a Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期五, 04 七月 2025 23:57:18 +0800 Subject: [PATCH] 测试图书 7.4 --- vue.config.js | 68 ++++++++++++++++++++++++++-------- 1 files changed, 52 insertions(+), 16 deletions(-) diff --git a/vue.config.js b/vue.config.js index 66342ce..dfbae49 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,25 +1,50 @@ const { defineConfig } = require("@vue/cli-service"); +const webpack = require("webpack"); +// 鑾峰彇鎵�鏈変功绫嶅垪琛� +const bookList = process.env.VUE_APP_BOOK_LIST + ? process.env.VUE_APP_BOOK_LIST.split("/") + : []; +const publicPath = process.env.VUE_APP_PUBLIC_PATH; module.exports = defineConfig({ - publicPath: "http://182.92.203.7:3007/books/book/1", + publicPath: process.env.VUE_APP_PUBLIC_PATH, transpileDependencies: true, lintOnSave: false, - // devServer: { - // open: true, - // historyApiFallback: true, - // allowedHosts: "all", - // headers: { - // "access-control-allow-origin": "*", - // }, - // client: { - // overlay: { warnings: false, errors: true } - // } - // }, + devServer: { + open: true, + historyApiFallback: true, + allowedHosts: "all", + headers: { + "access-control-allow-origin": "*", + }, + client: { + overlay: { warnings: false, errors: true }, + }, + }, configureWebpack: { output: { library: `app-content`, libraryTarget: "umd", - chunkLoadingGlobal: `webpackJsonp_app-content` - } + chunkLoadingGlobal: `webpackJsonp_app-content`, + }, + plugins: [ + new webpack.IgnorePlugin({ + checkResource(resource) { + if (process.env.VUE_APP_ENV == "product") { + // 缂栬瘧鍜屾墦鍖呰繃婊� + for (let i = 0; i < bookList.length; i++) { + const bookName = bookList[i]; + if (bookName != process.env.VUE_APP_BOOK_ID) { + // 杩囨护涓嶉渶瑕佺殑妯″潡 + if (resource.indexOf(bookName) > -1) { + return true; + } + } + } + } + return false; + }, + }), + ], }, chainWebpack: (config) => { config.module @@ -31,8 +56,19 @@ .loader("change-prefix-loader") .options({ prefix: "el-", - replace: "gp-" + replace: "gp-", }) .end(); - } + // config.module + // .rule("fonts") + // .test(/.(woff|woff2|eot|ttf|otf|TTF)$/) + // .type("asset/resource") + // .use("file-loader") + // .loader("file-loader") + // .options({ + // name: "fonts/[name].[hash:8].[ext]", // 杈撳嚭鍒� dist/fonts/ 鐩綍 + // publicPath: publicPath, // 纭繚 publicPath 姝g‘ + // limit: 0, + // }); + }, }); -- Gitblit v1.9.1