-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathnative-webpack.config.js
71 lines (69 loc) · 1.65 KB
/
native-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
const CopyWebpackPlugin = require('copy-webpack-plugin');
const arch = process.env.ARCH || process.arch;
const platform = process.env.PLATFORM || process.platform;
module.exports = {
externals: {
electron: "require('electron')",
buffer: "require('buffer')",
child_process: "require('child_process')",
crypto: "require('crypto')",
events: "require('events')",
fs: "require('fs')",
http: "require('http')",
https: "require('https')",
assert: "require('assert')",
dns: "require('dns')",
net: "require('net')",
os: "require('os')",
path: "require('path')",
querystring: "require('querystring')",
readline: "require('readline')",
repl: "require('repl')",
stream: "require('stream')",
string_decoder: "require('string_decoder')",
url: "require('url')",
util: "require('util')",
zlib: "require('zlib')",
'ffi-napi': "require('ffi-napi')"
},
module: {
rules: [
{
test: /\.node$/,
use: 'node-loader'
}
]
},
plugins: [
new CopyWebpackPlugin([
{
context: '.',
from: 'app.package.json',
to: 'package.json'
},
{
context: "native-artifacts/precompiled-libraries/" + arch + "/" + platform,
to: "native-artifacts/precompiled-libraries",
from: {
glob: "*",
dot: true
}
},
{
context: ".",
to: "",
from: {
glob: "native-artifacts/native-addons/*.node",
dot: true
}
}
], {
ignore: [
".gitkeep",
"**/.DS_Store",
"**/Thumbs.db"
],
debug: "warning"
})
]
};