-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.web.config.mjs
53 lines (49 loc) · 1.24 KB
/
webpack.web.config.mjs
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
import path from 'path';
import url from 'url';
import webpack from 'webpack';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
const dirname = path.dirname(url.fileURLToPath(import.meta.url));
export default (env) => ({
entry: './src/renderer/app.jsx',
mode: process.env.production ? 'production' : 'development',
devtool: 'source-map',
output: {
path: path.resolve(dirname, 'release/renderer'),
filename: '[name].bundle.js',
},
module: {
rules: [
{
test: /\.(jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
],
},
plugins: [
new webpack.DefinePlugin({
__BUILD_MODE__: JSON.stringify(env.buildMode),
}),
new MiniCssExtractPlugin({
filename: 'style.css',
}),
new HtmlWebpackPlugin({
template: './src/renderer/index.html',
favicon: './public/favicon.ico',
}),
],
resolve: {
alias: {
'@': path.resolve(dirname, './src/renderer'),
api: path.resolve(dirname, './src/api'),
},
extensions: ['.js', '.jsx', '.css'],
},
});