-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.app.dev.js
43 lines (41 loc) · 1.04 KB
/
webpack.app.dev.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
const path = require('path');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const CopyWebpackPlugin = require('copy-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin');
const { spawn } = require('child_process');
module.exports = merge(common, {
devtool: 'inline-source-map',
target: 'electron-renderer',
entry: {
background: './src/index.jsx'
},
output: {
filename: 'htmlapp.js',
path: path.resolve(__dirname, 'build')
},
devServer: {
contentBase: './build',
port: 8081,
stats: {
colors: true,
chunks: false,
children: false
},
before() {
spawn(
'electron',
['.'],
{ shell: true, env: process.env, stdio: 'inherit' }
)
.on('close', code => process.exit(0))
.on('error', spawnError => console.error(spawnError))
}
},
plugins: [
new CleanWebpackPlugin(['build', 'release']),
new CopyWebpackPlugin([
{from: './template/index.html', to: './index.html'}
])
]
});