-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathwebpack.config.ts
More file actions
66 lines (65 loc) · 1.62 KB
/
webpack.config.ts
File metadata and controls
66 lines (65 loc) · 1.62 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
import path from 'path';
import nodeExternals from 'webpack-node-externals';
import CopyPlugin from 'copy-webpack-plugin';
module.exports = {
entry: './ts-src/index.ts',
target: 'node',
mode: 'production',
externalsPresets: {
node: true,
},
externals: [nodeExternals()],
output: {
path: path.join(__dirname, 'dist'),
filename: 'index.prod.min.js',
library: {
name: 'java',
type: 'umd',
},
},
node: {
__dirname: false,
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.node$/,
loader: 'node-loader',
options: {
name: '[path][name].[ext]',
},
},
{
test: /native\.js/,
loader: 'string-replace-loader',
options: {
search: /require\(('java-bridge-[a-z\-0-9]+')\)/gi,
replace: '__non_webpack_require__($1)',
},
},
],
},
plugins: [
new CopyPlugin({
patterns: [
{
from: './java-src/build/libs/JavaBridge-*.jar',
to: 'JavaBridge.jar',
},
{
from: './native.d.ts',
to: 'native.d.ts',
},
],
}),
],
resolve: {
extensions: ['.ts', '.js'],
},
devtool: 'source-map',
};