-
-
Notifications
You must be signed in to change notification settings - Fork 291
/
Copy pathwebpack.renderer.config.js
45 lines (41 loc) · 1.24 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
// eslint-disable-next-line import/no-extraneous-dependencies
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
// eslint-disable-next-line import/no-extraneous-dependencies
const { IgnorePlugin } = require('webpack');
const rules = require('./webpack.rules');
const isDevelopment = process.env.NODE_ENV !== 'production';
rules.push(
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.s[ac]ss$/i,
use: ['style-loader', 'css-loader', 'sass-loader'],
}
);
/** @type {import("webpack").Configuration} */
module.exports = {
// Put your normal webpack config below here
module: {
rules,
},
mode: isDevelopment ? 'development' : 'production',
devServer: {
hot: isDevelopment,
},
plugins: [
isDevelopment && new ReactRefreshWebpackPlugin(),
// https://github.com/paulmillr/chokidar/issues/828#issuecomment-854306595
process.platform !== 'darwin' &&
new IgnorePlugin({
resourceRegExp: /^fsevents$/,
}),
].filter(Boolean),
externals: {
fsevents: "require('fsevents')",
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
};