56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
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")
|
|
|
|
module.exports = defineConfig({
|
|
publicPath: "/h5/",
|
|
outputDir: "build/h5",
|
|
transpileDependencies: true,
|
|
productionSourceMap: false,
|
|
configureWebpack: {
|
|
plugins: [
|
|
//当 unplugin-vue-components 版本大于等于 0.26.0 时,使用以下写法
|
|
AutoImport.default({ resolvers: [VantResolver()] }),
|
|
Components.default({ resolvers: [VantResolver()] }),
|
|
new fileanagerWebpackPlugin({
|
|
events: {
|
|
onEnd: {
|
|
delete: ["./build/h5.zip"],
|
|
archive: [
|
|
{
|
|
source: "./build/h5",
|
|
destination: "./build/h5.zip",
|
|
},
|
|
],
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
},
|
|
devServer: {
|
|
proxy: {
|
|
"/app": {
|
|
target: "http://8.138.144.54:8080",
|
|
// target: "https://do.tgsys.sztg.com",
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
chainWebpack: (config) => {
|
|
// SVG 规则排除 icons 目录
|
|
config.module.rule("svg").exclude.add(path.resolve("src/assets/icons"))
|
|
// 添加 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")
|
|
.options({ symbolId: "icon-[name]" })
|
|
},
|
|
})
|