-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.server.config.js
73 lines (71 loc) · 1.73 KB
/
webpack.server.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
66
67
68
69
70
71
72
73
// webpack.server.config.js
import path, { resolve as _resolve } from "path";
import webpack from 'webpack';
import { execSync } from "child_process";
export default (env, argv) => {
const isDevelopment = argv.mode === 'development'
const buildDir = isDevelopment ? 'build-dev' : 'build';
return {
devtool: "source-map",
mode: argv.mode || "development",
target: "node",
entry: "./src/server/index.tsx",
output: {
filename: "server.js",
path: _resolve(`./${buildDir}`),
module: true,
chunkFormat: "module",
library: { type: "module" },
libraryTarget: "module",
},
experiments: {
outputModule: true,
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: ["ts-loader"],
},
{
test: /\.css$/i,
use: ["css-loader"],
},
{
test: /\.json$/,
loader: 'json-loader',
type: 'javascript/auto',
},
{
test: /\.(png\|jpg\|gif\|avif\|\/otf\/|ttf)$/i,
loader: 'ignore-loader',
},
{
test: /\.node$/,
loader: 'node-loader',
},
],
},
resolve: {
alias: {
'mongodb-client-encryption': 'mongodb-client-encryption-browserify'
},
extensions: [".tsx", ".ts", ".js", ".jsx"],
},
ignoreWarnings: [
/aws-crt/,
/mongodb\/lib\/utils.js/,
/mongodb\/lib\/deps.js/
],
plugins: [
new webpack.DefinePlugin({
'global.GENTLY': false,
}),
new webpack.DefinePlugin({
'__dirname': JSON.stringify(_resolve()),
'__filename': JSON.stringify(_resolve('server.js')),
}),
],
}
};