-
Notifications
You must be signed in to change notification settings - Fork 10
/
webpack.backend.js
57 lines (55 loc) · 1.67 KB
/
webpack.backend.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
const
fs = require('fs'),
webpack = require('webpack'),
nodeModules = fs.readdirSync('./app/node_modules')
.filter(function (x) {
return ['.bin'].indexOf(x) === -1;
}),
config = {
context: __dirname + '/app',
entry: [
'./index.js'
],
target: 'electron',
output: {
path: './app',
publicPath: './app',
filename: 'main.js'
},
module: {
loaders: [
{
test: /\.js$/,
// exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['modern-browsers'],
plugins: [
'transform-class-properties'
]
}
}
]
},
node: {
__dirname: true,
__filename: true
},
externals: [
function (context, request, callback) {
let pathStart = request.split('/')[0];
if (nodeModules.indexOf(pathStart) >= 0) {
return callback(null, 'commonjs2 ' + request);
}
callback();
}
],
// recordsPath: path.join(__dirname, 'build/_records'),
plugins: [
new webpack.IgnorePlugin(/\.(css|less|html)$/),
// new webpack.BannerPlugin('require("source-map-support").install();',
// { raw: true, entryOnly: false }),
// new webpack.HotModuleReplacementPlugin({ quiet: true })
]
};
module.exports = config;