-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.renderer.config.js
53 lines (50 loc) · 1.32 KB
/
webpack.renderer.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
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
// target: 'electron-renderer', // do not set,
// causes "require is not defined" in electron-webpack-plugin
entry: { renderer: './src/renderer/app.jsx' },
mode: process.env.production ? 'production' : 'development',
devtool: 'source-map',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
],
},
experiments: {
syncWebAssembly: true,
},
plugins: [
new webpack.DefinePlugin({
__BUILD_MODE__: JSON.stringify('electron'),
}),
new MiniCssExtractPlugin({
filename: 'style.css',
}),
new CopyPlugin({
patterns: [
{ context: 'src/main/', from: 'preload.js', to: 'public/[name][ext]' },
{ context: 'public/', from: 'icon.png', to: 'public/[name][ext]' },
],
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src/renderer'),
api: path.resolve(__dirname, './src/api'),
},
extensions: ['.js', '.jsx', '.css'],
},
};