-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.common.js
More file actions
43 lines (35 loc) · 1.26 KB
/
webpack.common.js
File metadata and controls
43 lines (35 loc) · 1.26 KB
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
const path = require('path');
const AwsSamPlugin = require('aws-sam-webpack-plugin');
const awsSamPlugin = new AwsSamPlugin({ vscodeDebug: false });
module.exports = {
// Loads the entry object from the AWS::Serverless::Function resources in your
// SAM config. Setting this to a function will
entry: () => awsSamPlugin.entry(),
// Write the output to the .aws-sam/build folder
output: {
filename: (chunkData) => awsSamPlugin.filename(chunkData),
libraryTarget: 'commonjs2',
path: path.resolve('.'),
},
// Resolve .ts and .js extensions
resolve: {
extensions: ['.ts', '.js'],
},
// Target node
target: 'node',
// AWS recommends always including the aws-sdk in your Lambda package but excluding can significantly reduce
// the size of your deployment package. If you want to always include it then comment out this line. It has
// been included conditionally because the node10.x docker image used by SAM local doesn't include it.
// externals: process.env.NODE_ENV === 'development' ? [] : ['aws-sdk'],
externals: {
fsevents: 'require(\'fsevents\')',
},
// Add the TypeScript loader
module: {
rules: [{ test: /\.tsx?$/, loader: 'ts-loader' }],
},
// Add the AWS SAM Webpack plugin
plugins: [
awsSamPlugin
],
};