加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
gist006 提交于 2020-09-06 12:12 . 修改线上预览mock问题
const path = require("path");
function resolve(dir) {
return path.join(__dirname, dir);
}
const name = process.env.VUE_APP_BASE_NAME || "Vue Data Admin";
module.exports = {
publicPath: "./",
outputDir: "dist",
lintOnSave: false,
productionSourceMap: false,
devServer: {
port: 8999,
open: true,
overlay: {
warnings: false,
errors: true,
},
before:
process.env.NODE_ENV == "development"
? require("./mock/mock-server.js")
: "",
},
configureWebpack: {
name: name,
resolve: {
alias: {
"@": resolve("src"),
"@UI": resolve("UI"),
},
},
},
chainWebpack(config) {
config.when(process.env.NODE_ENV !== "development", (config) => {
config.optimization.splitChunks({
chunks: "all",
cacheGroups: {
libs: {
name: "chunk-libs",
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: "initial",
},
commons: {
name: "chunk-commons",
test: resolve("src/components"),
minChunks: 3,
priority: 5,
reuseExistingChunk: true,
},
},
});
config.optimization.runtimeChunk("single");
});
},
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化