-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.mjs
More file actions
73 lines (71 loc) · 1.56 KB
/
webpack.config.mjs
File metadata and controls
73 lines (71 loc) · 1.56 KB
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
import path from 'path';
import webpack from 'webpack';
import nodeExternals from 'webpack-node-externals';
import dotenv from 'dotenv';
const util = {
env: dotenv.config(),
isProduction: process.env.NODE_ENV === 'production',
},
__dirname = path.resolve();
export default {
mode: util.isProduction ? 'production' : 'development',
devtool: util.isProduction ? false : 'inline-source-map',
entry: './src/index.ts',
output: {
filename: 'index.cjs',
path: path.resolve(__dirname, 'dist'),
},
plugins: [],
externals: [
nodeExternals({
allowlist: ['webpack/hot/poll?100', /^@chargetrip/],
modulesFromFile: true,
additionalModuleDirs: [path.join(__dirname, '..', 'node_modules')],
}),
],
externalsPresets: { node: true },
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.js$/,
include: [path.resolve(__dirname, 'src')],
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
modules: false,
},
],
],
},
},
],
},
resolve: {
extensions: ['.ts', '.js'],
alias: {},
fallback: {
crypto: false,
util: false,
buffer: false,
path: false,
},
},
watchOptions: {
ignored: /node_modules/,
aggregateTimeout: 800,
poll: 1000,
},
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000,
},
};