-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
51 lines (50 loc) · 1.78 KB
/
webpack.config.js
File metadata and controls
51 lines (50 loc) · 1.78 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
const path = require('path');
module.exports = {
entry: {
"empty": './src/empty.ts'
},
mode: 'production',
target: 'node',
node: {
__dirname: true,
},
externals: [
function (context, request, callback) {
if (["assert", "buffer", "child_process", "curve25519-n2", "crypto", "dgram", "decimal.js", "ed25519", "events",
"fast-srp-hap", "fs", "getmac", "http", "mdns", "mqtt", "net", "noble", "noble-mac", "os", "path", "sequelize",
"sodium", "tls", "url", "util", "uws", "zigbee-herdsman", "modbus-serial", "openzwave-shared", "serialport", "socket.io", "ws"
].indexOf(request) !== -1) {
return callback(null, `require('${request}')`);
} else if (request.indexOf("../config/config") !== -1) {
return callback(null, `require('./config/config')`);
} else if (request.indexOf('/locale/') !== -1) {
return callback(null, `require('${request.substring(1, request.length)}')`);
} else if (context.indexOf('/templates') === context.length - 10) {
return callback(null, `./templates/${request}`, 'commonjs2');
}
const i = request.indexOf('.d.ts');
const ext = request.substring(request.lastIndexOf('.'), request.length);
if (['.proto', '.css', '.md', '.txt', '.html', '.png', '.jpg', '.eot', '.woff2', '.woff', '.otf', '.ttf'].indexOf(ext) !== -1 ||
(i !== -1 && i === request.length - 5)) {
return callback(null, `require('${request}')`);
}
callback();
}
],
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: [/templates/, /node_modules/, /migrations/]
}
]
},
resolve: {
extensions: [".tsx", ".ts", ".js"]
},
output: {
filename: 'dist/[name].js',
path: path.resolve(__dirname, './')
}
};