-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
63 lines (61 loc) · 1.7 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
/**
* package up each lambda individually
* saved 600ms on init time in graphql lambda
* and a lot in zip size (all zips are under 4MB total instead of 87MB before)
*/
var CopyWebpackPlugin = require('copy-webpack-plugin')
const path = require('path')
module.exports = {
mode: 'production',
target: 'node',
entry: {
graphql: './src/api/graphql-lambda.ts',
api: './src/api/lambda.ts',
refresher: './src/refresher/lambda.ts',
cleaner: './src/cleaner/lambda.ts',
worker: './src/worker/lambda.ts',
test: './test/index.ts',
},
output: {
libraryTarget: 'commonjs2',
path: path.resolve(__dirname, 'lambda'),
filename: '[name]/[name].js', // put in own sub folder so asset deployment zip can be a bit smaller for each lambda
},
resolve: {
extensions: ['.ts', '.js', '.mjs'],
},
externals: {
'@aws-sdk/client-dynamodb': '@aws-sdk/client-dynamodb',
'@aws-sdk/client-sqs': '@aws-sdk/client-sqs',
'@aws-sdk/lib-dynamodb': '@aws-sdk/lib-dynamodb',
},
plugins: [
// new CopyWebpackPlugin({ patterns: [
// {
// from: 'node_modules/chrome-aws-lambda',
// to: 'worker/node_modules/chrome-aws-lambda',
// },
// { from: 'node_modules/lambdafs', to: 'worker/node_modules/lambdafs' },
// ]}),
],
module: {
// configuration regarding modules
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: [/node_modules/],
},
// fixes https://github.com/graphql/graphql-js/issues/1272
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
// {
// test: /\.json$/,
// use: 'json-loader',
// },
],
},
}