2021-07-02 14:01:53 +08:00
|
|
|
|
const path = require('path');
|
2021-07-15 17:40:15 +08:00
|
|
|
|
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin')
|
2020-09-27 12:46:32 +08:00
|
|
|
|
|
|
|
|
|
function resolve(dir) {
|
2021-07-02 14:01:53 +08:00
|
|
|
|
return path.join(__dirname, dir);
|
2020-09-27 12:46:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-03 14:01:28 +08:00
|
|
|
|
module.exports = {
|
2021-06-11 16:19:04 +08:00
|
|
|
|
productionSourceMap: false,
|
2020-07-09 17:04:34 +08:00
|
|
|
|
devServer: {
|
|
|
|
|
port: 8080,
|
|
|
|
|
proxy: {
|
2021-02-25 13:46:01 +08:00
|
|
|
|
//1.8需求:增加分享功能,不登陆即可看到文档页面。所以代理设置增加了(?!/document)文档页面的相关信息
|
2021-03-02 18:22:22 +08:00
|
|
|
|
// ['^(?!/login)']: {
|
2021-02-25 13:46:01 +08:00
|
|
|
|
['^((?!/login)(?!/document))']: {
|
2021-10-12 13:42:46 +08:00
|
|
|
|
target: 'https://localhost:8443',
|
2020-07-09 17:04:34 +08:00
|
|
|
|
ws: true,
|
2021-02-25 13:46:01 +08:00
|
|
|
|
},
|
2020-07-09 17:04:34 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2021-07-02 14:22:11 +08:00
|
|
|
|
pages: {
|
|
|
|
|
business: {
|
|
|
|
|
entry: "src/business/main.js",
|
|
|
|
|
template: "src/business/index.html",
|
|
|
|
|
filename: "index.html"
|
|
|
|
|
},
|
|
|
|
|
login: {
|
|
|
|
|
entry: "src/login/login.js",
|
|
|
|
|
template: "src/login/login.html",
|
|
|
|
|
filename: "login.html"
|
|
|
|
|
},
|
|
|
|
|
document: {
|
|
|
|
|
entry: "src/document/document.js",
|
|
|
|
|
template: "src/document/document.html",
|
2021-07-15 17:40:15 +08:00
|
|
|
|
filename: "document.html",
|
|
|
|
|
},
|
2021-08-20 10:42:15 +08:00
|
|
|
|
sharePlanReport: {
|
|
|
|
|
entry: "src/template/report/plan/share/share-plan-report.js",
|
|
|
|
|
template: "src/template/report/plan/share/share-plan-report.html",
|
|
|
|
|
filename: "share-plan-report.html",
|
|
|
|
|
},
|
2022-02-10 15:13:46 +08:00
|
|
|
|
sharePerformanceReport: {
|
|
|
|
|
entry: "src/template/report/performance/share/share-performance-report.js",
|
|
|
|
|
template: "src/template/report/performance/share/share-performance-report.html",
|
|
|
|
|
filename: "share-performance-report.html",
|
|
|
|
|
},
|
2022-03-01 20:16:07 +08:00
|
|
|
|
shareApiReport: {
|
|
|
|
|
entry: "src/template/report/api/share/share-api-report.js",
|
|
|
|
|
template: "src/template/report/api/share/share-api-report.html",
|
|
|
|
|
filename: "share-api-report.html",
|
|
|
|
|
},
|
2022-09-01 10:16:35 +08:00
|
|
|
|
shareUiReport: {
|
|
|
|
|
entry: "src/template/report/ui/share/share-ui-report.js",
|
|
|
|
|
template: "src/template/report/ui/share/share-ui-report.html",
|
|
|
|
|
filename: "share-ui-report.html",
|
|
|
|
|
},
|
2021-12-14 14:58:23 +08:00
|
|
|
|
enterpriseReport: {
|
|
|
|
|
entry: "src/template/enterprise/share/share-enterprise-report.js",
|
|
|
|
|
template: "src/template/enterprise/share/share-enterprise-report.html",
|
|
|
|
|
filename: "share-enterprise-report.html",
|
|
|
|
|
},
|
2021-12-24 17:56:32 +08:00
|
|
|
|
planReport: { //这个配置要放最后,不然会导致测试计划导出报告没有将css和js引入html,原因没具体研究
|
|
|
|
|
entry: "src/template/report/plan/plan-report.js",
|
|
|
|
|
template: "src/template/report/plan/plan-report.html",
|
|
|
|
|
filename: "plan-report.html",
|
|
|
|
|
}
|
2021-07-02 14:22:11 +08:00
|
|
|
|
},
|
2020-09-27 12:46:32 +08:00
|
|
|
|
configureWebpack: {
|
2022-03-25 16:47:00 +08:00
|
|
|
|
devtool: 'cheap-module-source-map',
|
2020-09-27 12:46:32 +08:00
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': resolve('src')
|
|
|
|
|
}
|
2021-07-15 17:40:15 +08:00
|
|
|
|
},
|
2020-09-27 12:46:32 +08:00
|
|
|
|
},
|
2021-07-15 17:40:15 +08:00
|
|
|
|
chainWebpack: config => {
|
2022-07-04 15:11:41 +08:00
|
|
|
|
// svg rule loader
|
|
|
|
|
config.module
|
|
|
|
|
.rule('svg')
|
|
|
|
|
.exclude.add(resolve('src/assets/module'))
|
|
|
|
|
.end()
|
|
|
|
|
|
|
|
|
|
config.module
|
|
|
|
|
.rule('icons')
|
|
|
|
|
.test(/\.svg$/)
|
|
|
|
|
.include.add(resolve('src/assets/module'))
|
|
|
|
|
.end()
|
|
|
|
|
.use('svg-sprite-loader')
|
|
|
|
|
.loader('svg-sprite-loader')
|
|
|
|
|
.options({
|
|
|
|
|
symbolId: 'icon-[name]'
|
|
|
|
|
})
|
|
|
|
|
|
2021-07-15 17:40:15 +08:00
|
|
|
|
// 报告模板打包成一个html
|
|
|
|
|
config.plugin('html-planReport')
|
|
|
|
|
.tap(args => {
|
|
|
|
|
args[0].inlineSource = '.(js|css)$';
|
|
|
|
|
return args;
|
|
|
|
|
});
|
|
|
|
|
config.plugin('inline-source-html-planReport')
|
2021-12-14 14:58:23 +08:00
|
|
|
|
.after('html-planReport')
|
|
|
|
|
.use(HtmlWebpackInlineSourcePlugin);
|
2021-07-02 14:01:53 +08:00
|
|
|
|
config.plugins.delete('prefetch');
|
2021-12-14 14:58:23 +08:00
|
|
|
|
|
2020-07-09 17:04:34 +08:00
|
|
|
|
}
|
2020-02-03 15:16:37 +08:00
|
|
|
|
};
|