Commit c4870fa3 authored by gengshaojing's avatar gengshaojing

update: vue config

parent e0d63de7
const path = require("path");
const IS_PROD = process.env.NODE_ENV === "production";
const isDev = process.env.NODE_ENV === "development";
// CDN 链接配置
const CDN = {
......@@ -26,16 +27,16 @@ const CDN = {
};
module.exports = {
outputDir: !IS_PROD ? "./dist" : path.resolve("./public/dist/"),
publicPath: !IS_PROD ? "/" : "/dist",
lintOnSave: !IS_PROD,
outputDir: isDev ? "./dist" : path.resolve("./public/dist/"),
publicPath: isDev ? "/" : "/dist",
lintOnSave: isDev,
productionSourceMap: false, // 去掉生成环境的 sourceMap
devServer: {
proxy: "http://127.0.0.1:8055", //http://localhost:8055
hot: true,
disableHostCheck: true,
},
configureWebpack: config => {
configureWebpack: (config) => {
if (IS_PROD) {
config.externals = CDN.externals;
}
......@@ -46,7 +47,7 @@ module.exports = {
maxAssetSize: 30000000,
};
},
chainWebpack: config => {
chainWebpack: (config) => {
// 默认不开启 prefetch
config.plugins.delete("prefetch");
......@@ -57,7 +58,7 @@ module.exports = {
config.resolve.alias.set("@", path.resolve("src"));
// 修改页面 title
config.plugin("html").tap(args => {
config.plugin("html").tap((args) => {
args[0].title = "运营管理系统";
if (IS_PROD) {
args[0].cdn = CDN.build;
......@@ -67,7 +68,7 @@ module.exports = {
});
// 分包
config.when(IS_PROD, config => {
config.when(IS_PROD, (config) => {
config.optimization.splitChunks({
chunks: "all",
cacheGroups: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment