加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vue.config.js 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
孙余伟 提交于 2023-09-25 13:56 . 初始化
const path = require("path")
const minify =
process.env.NODE_ENV === "development"
? false
: {
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true,
minifyCSS: true,
minifyJS: true,
}
function resolve(dir) {
return path.resolve(__dirname, dir)
}
module.exports = {
publicPath: process.env.NODE_ENV === "production" ? "/admin/" : "/",
pages: {
index: {
entry: "src/main.js",
template: "public/index.html",
filename: "index.html",
chunks: ["chunk-vendors", "chunk-common", "index"],
minify,
},
},
devServer: {
port: 8888,
proxy: {
"/api/": {
target: process.env.VUE_APP_ROOT_URL_ENV,
changeOrigin: true,
ws: true,
pathRewrite: {
"^/api/": "",
},
},
},
},
lintOnSave: false,
runtimeCompiler: true,
productionSourceMap: false,
chainWebpack: config => {
config.resolve.alias.set("@", resolve("src"))
// set svg-sprite-loader
config.module
.rule("svg")
.exclude.add(resolve("src/icons"))
.end()
config.module
.rule("icons")
.test(/\.svg$/)
.include.add(resolve("src/icons"))
.end()
.use("svg-sprite-loader")
.loader("svg-sprite-loader")
.options({
symbolId: "icon-[name]",
})
.end()
},
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化