-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathvue.config.js
57 lines (54 loc) · 1.36 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* 配置example的vue-cli-service服务 */
const path = require("path");
const demoDirName = `examples/`;
const resolve = (dir) => path.join(__dirname, dir);
module.exports = {
publicPath: "/market-ui/demo",
pages: {
// spa应用入口配置
index: {
entry: path.join(demoDirName, "main.js"),
template: "./public/index.html",
// 页面标题
title: "Demo Page",
chunks: ["index", "chunk-vendors"],
},
},
outputDir: process.env.BUILD_DIR,
// 本地服务配置
devServer: {
// 端口号
port: process.env.SERVER_PORT,
// 不启用浏览器自动打开服务
open: false,
},
// webpack定制
configureWebpack: {
devtool:
process.env.NODE_ENV === "production"
? "hidden-source-map"
: "inline-source-map",
optimization: {
// 切割chunks
splitChunks: {
chunks: "async",
minSize: 20000,
minChunks: 1,
maxAsyncRequests: 30,
maxInitialRequests: 30,
enforceSizeThreshold: 50000,
},
},
output: {
crossOriginLoading: "anonymous",
// 解决webpack3 和 webpack4 runtime 默认函数webpackJsonp冲突
jsonpFunction: "webpack4JsonpIsArray",
},
// 别名-用于引用打包之后的组件源码
resolve: {
alias: {
"@tuia/market-ui": resolve("es"),
},
},
},
};