-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
61 lines (60 loc) · 2.2 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
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
const nodeExternals = require("webpack-node-externals");
module.exports = {
externals: [nodeExternals({
allowlist: ['node:buffer', 'node:fs', 'node:https', 'node:http', 'node:net', 'node:path', 'node:process', 'node:stream/web', 'node:stream', 'node:url', 'node:util', 'node:zlib'],
}),
],
plugins: [new NodePolyfillPlugin()],
resolve: {
fallback: {
assert: require.resolve("assert/"),
buffer: require.resolve("buffer/"),
console: require.resolve("console-browserify"),
constants: require.resolve("constants-browserify"),
crypto: require.resolve("crypto-browserify"),
domain: require.resolve("domain-browser"),
events: require.resolve("events/"),
fs: false,
https: require.resolve('https-browserify'),
http: require.resolve('stream-browserify'),
net: false,
os: require.resolve("os-browserify/browser"),
path: require.resolve("path-browserify"),
punycode: require.resolve("punycode/"),
process: require.resolve("process/browser"),
querystring: require.resolve("querystring-es3/"),
stream: require.resolve("stream-browserify"),
_stream_duplex: require.resolve("readable-stream/duplex"),
_stream_passthrough: require.resolve("readable-stream/passthrough"),
_stream_readable: require.resolve("readable-stream/readable"),
_stream_transform: require.resolve("readable-stream/transform"),
_stream_writable: require.resolve("readable-stream/writable"),
string_decoder: require.resolve("string_decoder/"),
timers: require.resolve("timers-browserify"),
tty: require.resolve("tty-browserify"),
url: require.resolve("url/"),
util: require.resolve("util/"),
vm: require.resolve("vm-browserify"),
zlib: require.resolve("browserify-zlib"),
},
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
esModuleInterop: true, // Ensure this option is set to true
},
exclude: /node_modules/,
},
],
},
node: {
global: true,
__filename: true,
__dirname: true,
},
};