-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathprod.config.js
98 lines (84 loc) · 2.93 KB
/
prod.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
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
/*
* Copyright (c) 2019 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const constants = require('./constants');
const entryPoints = require('./entryPoints');
let entries = {};
let plugins = [];
for (let i = 0; i < entryPoints.apps.length; i++) {
const entryPoint = entryPoints.apps[i];
entries[entryPoint.name] = entryPoint.path + '/app.tsx';
plugins = plugins.concat([
new HtmlWebpackPlugin({
inject: false,
name: entryPoint.name,
title: entryPoint.title,
permission: entryPoint.permission,
filename: '../../../views/' + entryPoint.name + '.view.xml',
template: 'webpack/app.view.template.xml'
}),
new HtmlWebpackPlugin({
inject: false,
filename: '../../../views/' + entryPoint.name + '.html',
template: 'webpack/app.template.html'
}),
new HtmlWebpackPlugin({
inject: false,
mode: 'dev',
name: entryPoint.name,
title: entryPoint.title,
permission: entryPoint.permission,
filename: '../../../views/' + entryPoint.name + 'Dev.view.xml',
template: 'webpack/app.view.template.xml'
}),
new HtmlWebpackPlugin({
inject: false,
mode: 'dev',
name: entryPoint.name,
filename: '../../../views/' + entryPoint.name + 'Dev.html',
template: 'webpack/app.template.html'
})
]);
if (entryPoint.webpart) {
plugins = plugins.concat([
new HtmlWebpackPlugin({
inject: false,
name: entryPoint.name,
title: entryPoint.title,
filename: '../../../views/' + entryPoint.name + '.webpart.xml',
template: 'webpack/app.webpart.template.xml'
}),
new HtmlWebpackPlugin({
inject: false,
mode: 'dev',
name: entryPoint.name + "Dev",
title: entryPoint.title + " Dev",
filename: '../../../views/' + entryPoint.name + 'Dev.webpart.xml',
template: 'webpack/app.webpart.template.xml'
})
])
}
}
plugins.push(new MiniCssExtractPlugin());
module.exports = {
context: constants.context(__dirname),
mode: 'production',
devtool: 'source-map',
entry: entries,
output: {
path: constants.outputPath(__dirname),
publicPath: './', // allows context path to resolve in both js/css
filename: '[name].js'
},
module: {
rules: constants.loaders.TYPESCRIPT_LOADERS.concat(constants.loaders.STYLE_LOADERS)
},
resolve: {
extensions: constants.extensions.TYPESCRIPT
},
plugins: plugins
};