-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.config.js
118 lines (114 loc) · 3.73 KB
/
webpack.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const LwcWebpackPlugin = require('lwc-webpack-plugin');
const path = require('path');
const fs = require('fs');
const config = {
entry: {
fallback: './src/client/index.js',
dataTools: './src/client/dataTools.js',
platformeventapp: './src/client/platformeventapp.js',
platformeventactivity: './src/client/platformeventactivity.js'
},
mode: 'production',
output: {
path: path.resolve('dist'),
filename: './[name].js'
},
plugins: [
new CleanWebpackPlugin(),
new LwcWebpackPlugin({
modules: [
{ dir: 'src/client/modules' },
{ npm: 'lightning-base-components' }
]
}),
new HtmlWebpackPlugin({
template: 'src/client/index.html',
filename: './index.html',
title: 'fallback',
chunks: ['fallback']
}),
new HtmlWebpackPlugin({
template: 'src/client/index.html',
filename: './dataTools/index.html',
title: 'Data Tools',
chunks: ['dataTools']
}),
new HtmlWebpackPlugin({
template: 'src/client/index.html',
filename: './platformeventapp/index.html',
title: 'Platform Event Config',
chunks: ['platformeventapp']
}),
new HtmlWebpackPlugin({
template: 'src/client/index.html',
filename: './platformeventactivity/index.html',
title: 'Platform Event Activity',
chunks: ['platformeventactivity']
}),
new CopyPlugin({
patterns: [
{
from: 'src/client/assets',
to: 'assets/'
},
{
from:
'node_modules/@salesforce-ux/design-system/assets/images',
to: 'assets/images'
},
{
from:
'node_modules/@salesforce-ux/design-system/assets/icons',
to: 'assets/icons'
},
{
from:
'node_modules/@salesforce-ux/design-system/assets/fonts',
to: 'assets/fonts'
},
{
from:
'node_modules/@salesforce-ux/design-system/assets/styles/salesforce-lightning-design-system.min.css',
to:
'assets/styles/salesforce-lightning-design-system.min.css'
}
]
})
],
stats: { assets: false }
};
// development only
if (process.env.NODE_ENV !== 'production') {
require('dotenv').config();
config.mode = 'development';
config.devtool = 'source-map';
config.devServer = {
contentBase: path.resolve(__dirname, 'dist'),
compress: true,
port: process.env.CLIENT_PORT,
stats: 'errors-only', //confirm if correct to stop full list
proxy: {
'/': {
target: `https://${process.env.HOST}:${process.env.PORT}/`,
secure: false
}
},
https: true,
key: fs.readFileSync(
path.join(__dirname, 'certificates', 'private.key'),
'ascii'
),
cert: fs.readFileSync(
path.join(__dirname, 'certificates', 'private.crt'),
'ascii'
),
ca: fs.readFileSync(
path.join(__dirname, 'certificates', 'private.pem'),
'ascii'
)
};
}
module.exports = config;