2025-02-27 21:08:26 +08:00
|
|
|
const { defineConfig } = require("@vue/cli-service")
|
|
|
|
|
const { VantResolver } = require("@vant/auto-import-resolver")
|
|
|
|
|
const AutoImport = require("unplugin-auto-import/webpack")
|
|
|
|
|
const Components = require("unplugin-vue-components/webpack")
|
|
|
|
|
const fileanagerWebpackPlugin = require("filemanager-webpack-plugin")
|
|
|
|
|
const path = require("path")
|
2025-01-28 15:25:35 +08:00
|
|
|
|
|
|
|
|
module.exports = defineConfig({
|
2025-02-11 21:47:01 +08:00
|
|
|
publicPath: "/h5/",
|
2025-02-12 14:50:39 +08:00
|
|
|
outputDir: "build/h5",
|
2025-01-28 15:25:35 +08:00
|
|
|
transpileDependencies: true,
|
|
|
|
|
productionSourceMap: false,
|
|
|
|
|
configureWebpack: {
|
|
|
|
|
plugins: [
|
|
|
|
|
//当 unplugin-vue-components 版本大于等于 0.26.0 时,使用以下写法
|
|
|
|
|
AutoImport.default({ resolvers: [VantResolver()] }),
|
|
|
|
|
Components.default({ resolvers: [VantResolver()] }),
|
2025-02-12 14:50:39 +08:00
|
|
|
new fileanagerWebpackPlugin({
|
|
|
|
|
events: {
|
|
|
|
|
onEnd: {
|
|
|
|
|
delete: ["./build/h5.zip"],
|
|
|
|
|
archive: [
|
|
|
|
|
{
|
|
|
|
|
source: "./build/h5",
|
|
|
|
|
destination: "./build/h5.zip",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}),
|
2025-01-28 15:25:35 +08:00
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
devServer: {
|
|
|
|
|
proxy: {
|
|
|
|
|
"/app": {
|
2025-02-08 23:02:24 +08:00
|
|
|
target: "http://8.138.144.54:8080",
|
2025-02-27 21:08:26 +08:00
|
|
|
// target: "https://do.tgsys.sztg.com",
|
2025-01-28 15:25:35 +08:00
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
chainWebpack: (config) => {
|
|
|
|
|
// SVG 规则排除 icons 目录
|
2025-02-27 21:08:26 +08:00
|
|
|
config.module.rule("svg").exclude.add(path.resolve("src/assets/icons"))
|
2025-01-28 15:25:35 +08:00
|
|
|
// 添加 icons 目录的 SVG loader
|
|
|
|
|
config.module
|
|
|
|
|
.rule("icons")
|
|
|
|
|
.test(/\.svg$/)
|
|
|
|
|
.include.add(path.resolve("src/assets/icons"))
|
|
|
|
|
.end()
|
|
|
|
|
.use("svg-sprite-loader")
|
|
|
|
|
.loader("svg-sprite-loader")
|
2025-02-27 21:08:26 +08:00
|
|
|
.options({ symbolId: "icon-[name]" })
|
2025-01-28 15:25:35 +08:00
|
|
|
},
|
2025-02-27 21:08:26 +08:00
|
|
|
})
|