-
Notifications
You must be signed in to change notification settings - Fork 39
/
webpack.base.config.js
59 lines (58 loc) · 1.67 KB
/
webpack.base.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
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const baseConfig = {
entry: './src/index.ts',
devtool: 'eval',
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
terserOptions: {
keep_classnames: true, // fixes empty string in `object.constructor.name`
},
})],
},
resolve: {
extensions: ['.ts', '.js', '.json'],
fallback: {
fs: false,
util: require.resolve('util/'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
buffer: require.resolve('buffer/'),
url: require.resolve('url/'),
assert: require.resolve('assert/'),
stream: require.resolve('stream-browserify'),
path: require.resolve('path-browserify'),
os: require.resolve('os-browserify/browser'),
zlib: require.resolve('browserify-zlib'),
events: require.resolve('events/'),
string_decoder: require.resolve('string_decoder/'),
tls: require.resolve('tls/'),
net: require.resolve('net/'),
process: require.resolve('process/browser'),
// Browser build have to use native WebSocket
ws: require.resolve('./build-utils/ws'),
},
},
plugins: [
new webpack.ProvidePlugin({
Buffer: [require.resolve('buffer/'), 'Buffer'],
process: require.resolve('process/browser'),
}),
],
output: {
path: path.resolve(__dirname, 'dist'),
},
};
module.exports = baseConfig;