From 3fef7541a1d60f550573e4695205283eeffbb5c4 Mon Sep 17 00:00:00 2001 From: litian <2804272236@qq.com> Date: 星期四, 02 一月 2025 15:17:09 +0800 Subject: [PATCH] ceshi --- vue.config.js | 27 +++++++++++++++++++++++---- 1 files changed, 23 insertions(+), 4 deletions(-) diff --git a/vue.config.js b/vue.config.js index e848709..8269352 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,9 +1,9 @@ -// const { publicCtx } = require("@/assets/js/config"); -// import {publicCtx} from '@/assets/js/config' 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("/") : []; module.exports = defineConfig({ - // publicPath: 'http://182.92.203.7:3007/books/book/1', - publicPath:'/books/book/1', + publicPath: process.env.VUE_APP_PUBLIC_PATH, transpileDependencies: true, lintOnSave: false, // devServer: { @@ -23,6 +23,25 @@ libraryTarget: "umd", 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 -- Gitblit v1.9.1