-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.renderer.js
70 lines (64 loc) · 1.42 KB
/
webpack.config.renderer.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
const { join, resolve } = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')
const { getConfig, dev } = require('./webpack.config.base')
const PORT = 5000
const config = {
target: 'electron-renderer',
entry: {
index: './src/renderer/app'
},
plugins: [],
output: {
path: resolve(__dirname, 'build'),
chunkFilename: '[name].[chunkhash].js'
},
optimization: {
moduleIds: 'hashed',
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
enforce: true
}
}
}
}
}
if (dev) {
config.devServer = {
contentBase: join(__dirname, 'build'),
port: PORT,
hot: true,
inline: true,
disableHostCheck: true,
historyApiFallback: true
}
config.output.publicPath = `http://localhost:${PORT}/`
config.plugins.push(new webpack.HotModuleReplacementPlugin())
}
const appConfig = getConfig(config, {
plugins: [
new HtmlWebpackPlugin({
title: 'Guildspeak',
template: './static/pages/index.html',
filename: 'index.html'
})
],
module: {
rules: [
{
test: /\.(png|gif|jpg|woff2|ttf|svg)$/,
use: ['url-loader']
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
}
})
module.exports = appConfig