-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.js
34 lines (31 loc) · 1.17 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
const ShebangPlugin = require('webpack-shebang-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const fs = require('fs')
const path = __dirname + '/lib/sip/sip-bundle.js'
if( !fs.existsSync(path) ) {
throw new Error(`\n\n*** SIP bundle does not exist at ${path}\n*** To create it run: npm run build:sipbundle:dev or npm run build:sipbundle:prod\n`)
}
module.exports = [
(env, argv) => {
const production = argv.mode === 'production'
return {
devtool: production ? undefined : 'source-map',
mode: 'development',
entry: {
'bundle': './controller.js',
'bundle-webrtc': './controller-webrtc.js',
'bundle-homekit': './controller-homekit.js'
},
target : 'node',
output: {
path: __dirname + '/dist',
filename: production ? '[name].js' : '[name]_dev.js'
},
optimization: {
// Avoids generating license files
minimizer: [new TerserPlugin({ extractComments: false })],
},
plugins: [ new ShebangPlugin() ]
}
}
]