-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.renderer.js
More file actions
82 lines (79 loc) · 2.1 KB
/
webpack.config.renderer.js
File metadata and controls
82 lines (79 loc) · 2.1 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (c) 2020-present grommunio GmbH. All Rights Reserved.
const path = require('path')
const {merge} = require('webpack-merge')
const HtmlWebpackPlugin = require("html-webpack-plugin")
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin")
const {baseConfig, isProduction, outputPath} = require('./webpack.config.base')
module.exports = merge(baseConfig,
{
entry: {
'main-main': './src/renderer/mainWindow/mainView/index.tsx',
'main-titleBar': './src/renderer/mainWindow/titleBarView/index.tsx',
},
output: {
path: outputPath,
filename: 'renderer_[name].bundle.js',
},
devServer: {
historyApiFallback: true,
},
optimization: {
splitChunks: {
chunks: 'all',
},
},
plugins: [
new HtmlWebpackPlugin({
title: 'grommunio Desk',
filename: 'main-main.html',
template: './src/index.html',
chunks: ['main-main'],
inject: true,
}),
new HtmlWebpackPlugin({
title: 'grommunio Desk',
filename: 'main-titleBar.html',
template: './src/index.html',
chunks: ['main-titleBar'],
inject: true,
}),
isProduction && new MiniCssExtractPlugin(),
],
target: 'web',
resolve: {
alias: {
'@utils': '/src/renderer/utils/',
},
},
module: {
rules: [
{
test: /\.css$/,
include: path.resolve(__dirname, "src"),
use: [
isProduction ? {loader: MiniCssExtractPlugin.loader} : {loader: 'style-loader'},
{
loader: 'css-loader',
options: {
modules: {
namedExport: false,
},
},
}
],
},
{
test: /\.(svg|png|jpg|gif)$/,
include: path.resolve(__dirname, "assets"),
type: "asset/inline",
},
],
},
optimization: {
minimizer: [
isProduction && new CssMinimizerPlugin(),
],
},
}
)