forked from EdgeApp/edge-currency-accountbased
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
79 lines (75 loc) · 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
const { exec } = require('child_process')
const path = require('path')
const webpack = require('webpack')
const { ESBuildMinifyPlugin } = require('esbuild-loader')
const debug = process.env.WEBPACK_SERVE
// Try exposing our socket to adb (errors are fine):
if (process.env.WEBPACK_SERVE) {
console.log('adb reverse tcp:8082 tcp:8082')
exec('adb reverse tcp:8082 tcp:8082', () => {})
}
const bundlePath = path.resolve(
__dirname,
'android/src/main/assets/edge-currency-accountbased'
)
module.exports = {
devtool: debug ? 'source-map' : undefined,
devServer: {
allowedHosts: 'all',
hot: false,
port: 8082,
static: bundlePath
},
entry: './src/index.ts',
mode: debug ? 'development' : 'production',
module: {
rules: [
{
exclude: /\/node_modules\//,
test: /\.ts$/,
use: {
loader: 'esbuild-loader',
options: { loader: 'ts' }
}
}
]
},
optimization: {
minimizer: [
new ESBuildMinifyPlugin({
target: 'chrome67'
})
]
},
output: {
chunkFilename: '[name].chunk.js',
filename: 'edge-currency-accountbased.js',
path: bundlePath
},
plugins: [
new webpack.IgnorePlugin({ resourceRegExp: /^(https-proxy-agent)$/ }),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
}),
new webpack.ProvidePlugin({
process: path.resolve('node_modules/process/browser.js')
})
],
resolve: {
extensions: ['.ts', '.js'],
fallback: {
// assert: require.resolve('assert'),
crypto: require.resolve('crypto-browserify'),
fs: false,
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
path: require.resolve('path-browserify'),
stream: require.resolve('stream-browserify'),
string_decoder: require.resolve('string_decoder'),
// url: require.resolve('url'),
vm: require.resolve('vm-browserify')
}
},
target: ['web', 'es5']
}