-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
52 lines (41 loc) · 1.42 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
const webpack = require('webpack');
const AwsSamPlugin = require('aws-sam-webpack-plugin');
const awsSamPlugin = new AwsSamPlugin();
module.exports = {
// Loads the entry object from the AWS::Serverless::Function resources in your
// template.yaml or template.yml
entry: awsSamPlugin.entry(),
// Write the output to the .aws-sam/build folder
output: {
filename: '[name]/index.js',
libraryTarget: 'commonjs2',
path: __dirname + '/.aws-sam/build/',
},
// Create source maps
devtool: 'source-map',
// Resolve .ts and .js extensions
resolve: {
extensions: ['.ts', '.js', '.json'],
},
// Target node
target: 'node',
// Includes the aws-sdk only for development. The node10.x docker image
// used by SAM CLI Local doens't include it but it's included in the actual
// Lambda runtime.
//externals: process.env.NODE_ENV === "development" ? [] : ["aws-sdk"],
// Set the webpack mode
mode: 'development',
// Add the TypeScript loader
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
},
],
},
// to work around a sequelize bug: https://github.com/sequelize/sequelize/issues/7509
externals: ['sqlite3', 'tedious', 'mysql2', 'mariadb'],
// Add the AWS SAM Webpack plugin
plugins: [awsSamPlugin, new webpack.IgnorePlugin(/^pg-native$/)],
};