a0ea7efe
梁保满
init
|
1
2
3
|
const path = require("path");
const resolve = (dir) => path.join(__dirname, dir);
const IS_PROD = ["production", "prod"].includes(process.env.NODE_ENV);
|
02917cfa
liufangjia
feat: 新增错题组卷
|
4
5
|
const BundleAnalyzerPlugin =
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
|
ead476dd
LH_PC
fix:最终定版
|
6
7
|
const TimeStamp = new Date().getTime();
|
a0ea7efe
梁保满
init
|
8
9
10
11
12
13
14
15
|
module.exports = {
publicPath: "./", // 编译后的地址,可以根据环境进行设置
outputDir: "dist", // 生产环境构建文件的目录
assetsDir: "static", // 静态文件目录
lintOnSave: false, //是否开启编译时是否不符合eslint提示
productionSourceMap: false, // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: {
|
6bca489d
LH_PC
云平台二期UI
|
16
|
hot: true,
|
b769660c
梁保满
备课组题细节调整,随堂问列表页面开发完成
|
17
|
port: 8081, // 端口
|
a0ea7efe
梁保满
init
|
18
19
20
21
22
23
24
|
open: false, // 启动后打开浏览器
compress: true,
overlay: {
// 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层
warnings: false,
errors: true,
},
|
ee6e7628
梁保满
备题组卷借口数据对接调整
|
25
26
|
proxy: {
"/": {
|
0bb1a617
梁保满
兼容长水登录错误信息隐藏
|
27
|
// target:"http://ezquiz.sunvotecloud.cn",
|
6bca489d
LH_PC
云平台二期UI
|
28
|
// target:"http://192.168.1.151:8089",
|
574f1a90
LH_PC
fix:修改年级组长/任课老师缺少...
|
29
|
// target: "https://ezquiz.sunvotecloud.cn",
|
02917cfa
liufangjia
feat: 新增错题组卷
|
30
31
|
target: "http://121.40.127.171:8090",
// target:"http://127.0.0.1:8089",
|
ee6e7628
梁保满
备题组卷借口数据对接调整
|
32
|
changeOrigin: true,
|
6bca489d
LH_PC
云平台二期UI
|
33
|
ws: true,
|
ee6e7628
梁保满
备题组卷借口数据对接调整
|
34
35
|
},
},
|
02917cfa
liufangjia
feat: 新增错题组卷
|
36
|
disableHostCheck: true,
|
a0ea7efe
梁保满
init
|
37
|
},
|
574f1a90
LH_PC
fix:修改年级组长/任课老师缺少...
|
38
39
40
41
42
43
44
|
// configureWebpack: {
// devtool: 'source-map',
// output: { // 输出重构 打包编译后的 文件名称 【模块名称.版本号.js】
// filename: `js/[name]${TimeStamp}.js`,
// chunkFilename: `js/[name]${TimeStamp}.js`
// },
// },
|
a0ea7efe
梁保满
init
|
45
46
47
|
css: {
extract: IS_PROD, // 是否将组件中的 CSS 提取至一个独立的 CSS 文件中 (而不是动态注入到 JavaScript 中的 inline 代码)。
sourceMap: false,
|
574f1a90
LH_PC
fix:修改年级组长/任课老师缺少...
|
48
49
50
51
52
|
// extract: {
// // 修改打包后css文件名 // css打包文件,添加时间戳
// filename: `css/[name]${TimeStamp}.css`,
// chunkFilename: `css/[name]${TimeStamp}.css`
// }
|
a0ea7efe
梁保满
init
|
53
54
|
},
chainWebpack: (config) => {
|
02917cfa
liufangjia
feat: 新增错题组卷
|
55
56
|
config.plugin("html").tap((args) => {
args[0].title = "云平台";
|
a0ea7efe
梁保满
init
|
57
58
59
60
61
62
63
64
65
66
|
return args;
});
config.resolve.alias
.set("@", resolve("src"))
.set("assets", resolve("src/assets"))
.set("components", resolve("src/components"))
.set("router", resolve("src/router"))
.set("utils", resolve("src/utils"))
.set("store", resolve("src/store"))
.set("views", resolve("src/views"))
|
ef16e57e
LH_PC
fix:前端版本迭代
|
67
|
.set("config", resolve("src/config"))
|
a0ea7efe
梁保满
init
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
.set("api", resolve("src/api"));
if (IS_PROD) {
config.plugin("webpack-report").use(BundleAnalyzerPlugin, [
{
analyzerMode: "static",
},
]);
}
config.when(IS_PROD, (config) => {
config.devtool("cheap-source-map");
config
.plugin("ScriptExtHtmlWebpackPlugin")
.after("html")
.use("script-ext-html-webpack-plugin")
.end();
config.optimization.splitChunks({
chunks: "all",
cacheGroups: {
// cacheGroups 下可以可以配置多个组,每个组根据test设置条件,符合test条件的模块
commons: {
name: "chunk-commons",
test: resolve("src/components"),
minChunks: 3, // 被至少用三次以上打包分离
priority: 5, // 优先级
reuseExistingChunk: true, // 表示是否使用已有的 chunk,如果为 true 则表示如果当前的 chunk 包含的模块已经被抽取出去了,那么将不会重新生成新的。
},
node_vendors: {
name: "chunk-libs",
chunks: "initial", // 只打包初始时依赖的第三方
test: /[\\/]node_modules[\\/]/,
priority: 10,
},
elementUI: {
name: "chunk-elementUI", // 单独将 elementUI 拆包
priority: 20, // 数字大权重到,满足多个 cacheGroups 的条件时候分到权重高的
test: /[\\/]node_modules[\\/]_?element(.*)/,
},
},
});
config.optimization.runtimeChunk("single");
config.optimization.minimize(true);
});
},
};
|