-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.build.config.js
73 lines (70 loc) · 1.95 KB
/
webpack.build.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
65
66
67
68
69
70
71
72
73
const webpack = require('webpack');
const path = require('path');
const fs = require('fs');
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function(x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function(mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
new webpack.EnvironmentPlugin({
NODE_ENV: 'production'
}),
module.exports = {
externals: nodeModules,
entry: [
'./src/index.js'
],
target: 'electron-renderer',
output: {
path: path.join(__dirname, 'src'),
publicPath: './src/',
filename: 'renderer.prod.js'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['react','es2015','stage-0'],
plugins: [
"transform-decorators-legacy", "transform-decorators",
"transform-class-properties",
["import", { "libraryName": "antd", "libraryDirectory": "es", "style": "css" }] // `style: true` for less
]
}
},
{ test: /\.css$/, loader: "style-loader!css-loader" },
{
test: /\.(?:ico|gif|png|jpg|jpeg|webp)$/,
use: 'url-loader'
},
// YAML
{
test: /\.yaml$/,
use: [{ loader: 'json-loader' }, { loader: 'yaml-loader' }],
},
],
loaders: [
{
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-1']
}
},
]
},
resolve: {
extensions: ['.js', '.jsx']
},
devServer: {
historyApiFallback: true,
contentBase: './',
port: 4172
}
};