-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.renderer.babel.js
More file actions
89 lines (86 loc) · 1.87 KB
/
Copy pathwebpack.config.renderer.babel.js
File metadata and controls
89 lines (86 loc) · 1.87 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import webpack from 'webpack';
import cssImport from 'postcss-import';
import cssNested from 'postcss-nested';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
const serverIp = '0.0.0.0';
const serverPort = '4010';
export default {
target: 'web',
entry: {
renderer: [
'./src/renderer/index.js',
`webpack-dev-server/client?http://${serverIp}:${serverPort}`,
'webpack/hot/only-dev-server',
],
},
output: {
filename: '[name].js',
publicPath: '/',
},
devServer: {
host: serverIp,
port: serverPort,
contentBase: './src/renderer',
historyApiFallback: true,
stats: {
chunks: false,
},
proxy: {
'/api/*': 'http://107.170.52.153:4007/',
},
},
externals(context, request, callback) {
let isExternal = false;
const load = [
'electron',
];
if (load.includes(request)) {
isExternal = `require("${request}")`;
}
callback(null, isExternal);
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.css$/,
exclude: /node_modules/,
loader: ExtractTextPlugin.extract(
'css-loader?sourceMap&modules&localIdentName=[local]___[hash:base64:5]!postcss-loader',
),
},
{
test: /\.css$/,
include: /node_modules/,
loader: ExtractTextPlugin.extract(
'css-loader?sourceMap!postcss-loader',
),
},
{
test: /\.(png|jpg|jpeg|gif|svg)(\?v=\d+\.\d+\.\d+)?$/i,
loader: 'url-loader?limit=10000',
},
],
},
postcss() {
return [
cssImport,
cssNested,
];
},
plugins: [
new ExtractTextPlugin('[name].css', {
disable: false,
allChunks: true,
}),
new webpack.HotModuleReplacementPlugin(),
],
};
export {
serverIp,
serverPort,
};