forked from DefiLlama/bridges-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
56 lines (55 loc) · 1.32 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
const slsw = require("serverless-webpack");
const path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
const nodeExternals = require("webpack-node-externals");
module.exports = {
entry: slsw.lib.entries,
output: {
libraryTarget: "commonjs",
filename: "[name].js",
path: path.join(__dirname, ".webpack"),
},
target: "node",
mode: slsw.lib.webpack.isLocal ? "development" : "production",
externals: [nodeExternals()],
optimization: {
minimize: true,
minimizer: [new TerserPlugin({ terserOptions: { keep_classnames: true } })],
splitChunks: {
chunks: "all",
minSize: 10000,
maxSize: 250000,
},
},
module: {
rules: [
{
test: /\.ts$/,
use: "ts-loader",
include: path.resolve(__dirname, "src"),
exclude: /node_modules/,
},
{
test: /\.js$/,
include: __dirname,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
{
test: /\.mjs$/,
resolve: { mainFields: ["default"] },
},
],
},
resolve: {
mainFields: ["main", "browser"],
symlinks: false,
extensions: [".ts", ".js", ".json"],
alias: {
"bignumber.js$": "bignumber.js/bignumber.js",
"node-fetch$": "node-fetch/lib/index.js",
},
},
};