-
Notifications
You must be signed in to change notification settings - Fork 232
/
webpack.renderer.config.js
64 lines (60 loc) · 1.45 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
54
55
56
57
58
59
60
61
62
63
64
const rules = require('./webpack.rules');
const plugins = require('./webpack.plugins');
const TerserPlugin = require("terser-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
rules.push({
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
{
loader: 'postcss-loader',
},
],
});
rules.push({
test: /\.(png|jpg|svg|jpeg|gif|exr)$/i,
use: [
{
loader: 'file-loader',
options: {
name: 'img/[name].[ext]',
publicPath: '../.'
}
},
],
});
const libraries = [];
if (process.platform == "linux") libraries.push({ from: "build/Release/*.so", to: "[name][ext]" });
if (process.platform == "darwin") libraries.push({ from: "build/Release/*.dylib", to: "[name][ext]" });
if (process.platform == "win32") libraries.push({ from: "build/Release/*.dll", to: "[name][ext]" });
plugins.push(
new CopyPlugin({
patterns: libraries,
})
)
module.exports = {
'node': {
__dirname: false,
},
module: {
rules,
},
plugins: plugins,
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css'],
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
terserOptions: { keep_classnames: true }
})],
},
devServer: {
liveReload: false,
},
};