-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.lambda.config.js
55 lines (52 loc) · 1.34 KB
/
webpack.lambda.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
/**
* Webpack Configuration to package code for deployment to AWS Lambda.
*/
"use strict";
const _ = require('lodash');
const path = require('path');
const webpack = require('webpack');
const NodeExternals = require('webpack-node-externals');
module.exports = {
bail: true, // exit on any error
entry: {
// Entry point is our Lambda handler function
'testfct1': './handlers/testfct1/handler.js',
'testfct2': './handlers/testfct2/handler.js'
},
output: {
libraryTarget: 'commonjs2',
path: path.join(__dirname, '.webpack'),
filename: 'handlers/[name]/handler.js', // this should match the first part of function handler in serverless.yml
},
target: 'node',
resolve: {
extensions: ['.js', '.json']
},
devtool: process.env.LOCAL ? 'source-map' : undefined,
plugins: _.compact([
new webpack.optimize.ModuleConcatenationPlugin(),
]),
externals: [
// We exclude all (but selected) node modules here as the serverless-webpack
// plugin will automatically inject them again later. This way we keep
// development dependencies (i.e. serverless itself) out of our deployment.
NodeExternals({})
],
module: {
rules: [
{
// Process ES6 with Babel.
test: /\.(js|jsx)$/,
use: [
{
loader: "babel-loader",
options: {
presets: [ "node6", "stage-0" ],
plugins: []
}
}
],
}
]
}
};