-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
65 lines (64 loc) · 1.68 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
64
65
const path = require('path');
const webpack = require('webpack');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
module.exports = {
mode: 'production',
entry: {
orchestrator: path.join(__dirname, 'src', 'handler', 'task1.ts'),
aggregateDetectorsResult: path.join(__dirname, 'src', 'handler', 'task2.ts'),
},
resolve: {
plugins: [new TsconfigPathsPlugin({ configFile: './tsconfig.json' })],
extensions: ['.json', '.tsx', '.ts', '.js'],
},
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, 'dist'),
filename: '[name].js',
},
target: 'node',
devtool: 'inline-cheap-module-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
},
exclude: /node_modules/,
},
],
},
optimization: {
minimize: false,
},
externals: {
'aws-sdk': 'aws-sdk',
},
plugins: [
new ForkTsCheckerWebpackPlugin({
eslint: {
files: './src/**/*.{ts,tsx,js,jsx}', // required - same as command `eslint ./src/**/*.{ts,tsx,js,jsx} --ext .ts,.tsx,.js,.jsx`
},
}),
new webpack.IgnorePlugin({
checkResource(resource) {
const lazyImports = [
'cache-manager',
'apollo-server-fastify',
];
if (!lazyImports.includes(resource)) {
return false;
}
try {
require.resolve(resource);
} catch (err) {
return true;
}
return false;
},
}),
],
};