-
Notifications
You must be signed in to change notification settings - Fork 35
/
webpack.config.js
74 lines (70 loc) · 1.75 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
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:8083 tcp:8083')
exec('adb reverse tcp:8083 tcp:8083', () => {})
}
const bundlePath = path.resolve(
__dirname,
'android/src/main/assets/edge-exchange-plugins'
)
module.exports = {
devtool: debug ? 'source-map' : undefined,
devServer: {
allowedHosts: 'all',
hot: false,
port: 8083,
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-exchange-plugins.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: {
crypto: require.resolve('crypto-browserify'),
fs: false,
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
stream: require.resolve('stream-browserify'),
url: require.resolve('url')
}
},
target: ['web', 'es5']
}