-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathwebpack.renderer.config.js
More file actions
53 lines (46 loc) 路 1.19 KB
/
Copy pathwebpack.renderer.config.js
File metadata and controls
53 lines (46 loc) 路 1.19 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
const path = require('path');
const rules = require('./webpack.rules');
const plugins = require('./webpack.plugins');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const isDevelopment = process.env.NODE_ENV !== 'production';
rules.push({
test: /\.(woff|woff2|svg)$/,
sideEffects: true,
type: 'asset/resource'
});
rules.push({
test: /\.css$/,
sideEffects: true,
use: [{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: "../",
}
}, 'css-loader'],
});
plugins.push(new MiniCssExtractPlugin({
filename: "assets/[name].css",
}));
if (isDevelopment) {
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
plugins.push(new ReactRefreshWebpackPlugin({
esModule: true,
}));
}
module.exports = {
module: {
rules,
},
devServer: {
hot: isDevelopment,
},
plugins,
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css'],
alias: {
app: path.resolve(__dirname, 'src', 'app'),
main: path.resolve(__dirname, 'src', 'main'),
}
},
devtool: isDevelopment ? 'source-map' : false,
};