-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
67 lines (63 loc) · 1.57 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
const path = require('path')
const LwcWebpackPlugin = require('@lukethacoder/lwc-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
const lwcConfig = require('./lwc.config.json')
// automatically pull from lwc.config.json
const namePathModules = lwcConfig.modules.reduce((acc, module) => {
if (!!module.name && !!module.path) {
return {
...acc,
[module.name]: path.resolve(
__dirname,
module.path.replace('$rootDir/', './')
),
}
}
return acc
}, {})
module.exports = {
mode: 'development',
entry: {
app: './config/index.js',
},
devServer: {
static: './dist',
hot: true,
},
plugins: [
new LwcWebpackPlugin({
rootDir: './',
}),
new HtmlWebpackPlugin({ template: './config/index.html' }),
new CopyPlugin({
patterns: ['assets'],
}),
],
resolve: {
alias: {
...namePathModules,
public: path.resolve(__dirname, 'public'),
'@salesforce/label': path.resolve(
__dirname,
`./__mocks__/@salesforce/label`
),
'@salesforce/i18n': path.resolve(
__dirname,
`./__mocks__/@salesforce/i18n`
),
'lightning/uiRecordApi': path.resolve(
__dirname,
`./__mocks__/lightning/uiRecordApi`
),
'@salesforce/messageChannel': path.resolve(
__dirname,
`./__mocks__/@salesforce/messageChannel`
),
'lightning/messageService': path.resolve(
__dirname,
`./__mocks__/lightning/messageService`
),
},
},
}