-
Notifications
You must be signed in to change notification settings - Fork 47
/
webpack.config.lambda.ts
60 lines (58 loc) · 1.49 KB
/
webpack.config.lambda.ts
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
import CopyPlugin from 'copy-webpack-plugin';
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
import type { Configuration } from 'webpack';
const lambdaConfig: Configuration = {
externals: {
'@sparticuz/chromium': 'commonjs @sparticuz/chromium',
'aws-crt': 'commonjs aws-crt',
'puppeteer-core': 'commonjs puppeteer-core',
},
mode: 'production',
module: {
rules: [
{
exclude: /node_modules/,
// eslint-disable-next-line
test: /\.(jsx)$/,
use: ['babel-loader'],
},
{
// eslint-disable-next-line
test: /\.(map|node)$/,
use: ['file-loader'],
},
{
exclude: /node_modules/,
// eslint-disable-next-line
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
],
},
],
},
optimization: {
minimize: false,
},
plugins: [
new CopyPlugin({
patterns: [
{ from: 'node_modules/pdfjs-dist/legacy/build', to: '.' },
{ from: 'node_modules/pdf-lib/dist', to: '.' },
{ from: 'shared/static/pdfs/amended-petition-form.pdf', to: '.' },
],
}),
],
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
plugins: [new TsconfigPathsPlugin()], // Allows us to use the tsconfig path alias + basePath
},
target: 'node',
};
// eslint-disable-next-line import/no-default-export
export default lambdaConfig;