-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
98 lines (97 loc) · 2.93 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
const webpack = require('webpack');
const path = require('node:path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const WebpackBuildNotifierPlugin = require('webpack-build-notifier');
const CopyPlugin = require('copy-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: {
main: './src/index.js',
background: './src/backgroundWindow/background.js'
},
target: 'electron-renderer',
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'esbuild-loader',
include: path.join(__dirname, 'src'),
options: {
loader: 'jsx',
}
},
{
test: /\.html$/,
use: [
{
loader: 'html-loader'
}
]
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
type: 'asset/resource'
},
{
test: /\.(png|jpg|jpeg|gif)$/,
type: 'asset/resource'
},
{
test: /\.css$/,
loader: 'style-loader'
},
{
test: /\.css$/,
loader: 'css-loader',
options: {
modules: {
localIdentName: '[name]__[local]--[hash:base64:5]'
}
}
}
]
},
output: {
globalObject: 'this',
hashFunction: 'sha256'
},
resolve: {
alias: {
components: path.resolve(__dirname, './src/components/'),
mainProcess: path.resolve(__dirname, './src/mainProcess/'),
store: path.resolve(__dirname, './src/store/'),
utils: path.resolve(__dirname, './src/utils/'),
assets: path.resolve(__dirname, './src/assets/'),
plotting: path.resolve(__dirname, './src/plotting/'),
filters: path.resolve(__dirname, './src/filters/')
},
extensions: ['.js', '.jsx', '.json']
},
plugins: [
new HtmlWebPackPlugin({
filename: 'index.html',
template: 'src/index.html',
chunks: ['main']
}),
new HtmlWebPackPlugin({
filename: 'background.html',
template: 'src/backgroundWindow/background.html',
chunks: ['background']
}),
new webpack.HotModuleReplacementPlugin(),
new CopyPlugin({
patterns: [{ from: 'src/assets', to: 'assets' }]
}),
new WebpackBuildNotifierPlugin({
title: 'webpack built',
showDuration: true
}),
new ProgressBarPlugin()
],
devServer: {
watchContentBase: true
}
};