-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoly.config.js
68 lines (62 loc) · 1.76 KB
/
doly.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
58
59
60
61
62
63
64
65
66
67
68
const path = require("path");
const pkg = require("./package.json");
module.exports = {
entry: {
[pkg.name]: ["./src/utils/polyfill", "./src/app.js"]
},
html: {
template: "src/document.ejs",
filename: "index.html"
},
// 优化,可参考:https://webpack.docschina.org/plugins/split-chunks-plugin/
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /node_modules/,
chunks: "all",
name: "vendor",
priority: -10,
enforce: true
}
}
}
},
// 别名
alias: {
"~": path.join(__dirname, "./src")
},
// 构建完成后生成zip包路径
zip: `_build/${pkg.name}-${pkg.version}.zip`,
// 定义编译时变量替换
define: {
// api 地址
API_URL: "",
DEV: true
},
// 不同环境配置
env: {
// 生产环境
production: {
publicPath: "/", // 静态资源基础域名路径,如 https://img.99bill.com/
html: {
template: "src/document.ejs",
filename: "seashell/webapp/product/project/index.html" // 构建后的html路径,如 seashell/webapp/x-project/agent/index.html
},
outputFilename: "res/j/[name].[chunkhash:8].js", // js入口构建后路径
outputChunkFilename: "res/j/[name].[chunkhash:8].chunk.js", // js块构建后路径
css: {
filename: "res/c/[name].[contenthash:8].css", // css文件构建后路径
chunkFilename: "res/c/[name].[contenthash:8].chunk.css" // css块构建后路径
},
image: {
name: "res/i/[name].[hash:8].[ext]", // 图片构建后路径
limit: 1024 * 8 // 小于该大小的图片转为base64
},
define: {
API_URL: "", // 生产环境的api地址
DEV: false
}
}
}
};