-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
52 lines (48 loc) · 879 Bytes
/
webpack.config.js
File metadata and controls
52 lines (48 loc) · 879 Bytes
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
const path = require('path')
const ZipPlugin = require('zip-webpack-plugin')
/**
* Output directory
*/
const buildDir = path.join(__dirname, 'build')
/**
* Lambda Functions
*/
const entryPoints = {
'http-create': './src/controllers/create.js',
'http-show': './src/controllers/show.js'
}
/**
* Bundle each function individually
*/
const plugins = {
plugins: Object.keys(entryPoints).map((entryName) => new ZipPlugin({
path: buildDir,
filename: entryName,
extension: 'zip'
}))
}
/**
* Webpack config
*/
module.exports = {
mode: 'production',
target: 'node',
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
type: 'javascript/esm'
}
]
},
entry: entryPoints,
output: {
libraryTarget: 'commonjs2',
path: buildDir
},
optimization: {
minimize: false
},
...plugins
}