forked from todbot/Blink1Control2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
68 lines (63 loc) · 2.12 KB
/
webpack.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
// webpack.config.js
var webpack = require('webpack');
var path = require('path');
var config = {
// target: 'atom',
target: 'electron',
context: path.join(__dirname, '/app'),
// entry: path.join(__dirname, './src/maingui.js'),
// entry: __dirname + '/src' + './maingui.js',
entry: './maingui.js',
output: {
filename: 'bundle.js',
path: path.join(__dirname, '/app/build'),
// publicPath: 'http://localhost:8080/build/'
},
// see: https://github.com/chentsulin/webpack-target-electron-renderer/pull/7
externals: {
"express": 'commonjs express',
"node-hid": 'commonjs node-hid',
'nconf': 'commonjs nconf',
'xml2js': 'commonjs xml2js' // this is to keep webpack from complaing about optional dep of 'needle'
},
plugins: [
// new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /de|fr|hu/) // moment
// new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
// new webpack.IgnorePlugin(/mqtt.min/), //
new webpack.IgnorePlugin(/vertx/), // for skyweb (maybe not needed anymore?)
new webpack.DefinePlugin({
'process.env':{
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}
})
],
module: {
noParse: [
// /mqtt.min/
],
// noParse: [
// // ['ws']
// ],
loaders: [
{
test: /\.js|\.jsx$/,
query: { presets: ['react','es2015'] },
// loader: 'babel-loader',
loader: ['babel-loader'],
exclude: /node_modules/
},
{ test: /mqtt\/.*\.js/, loader: 'shebang-loader', include: [/node_modules\/mqtt/] },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" },
{ test: /\.json$/, loader: "json"}
]
}
};
if( process.env.NODE_ENV === 'development' ) {
config.output.publicPath = 'http://localhost:8080/build/';
} else {
config.output.publicPath= './build/';
// config.output.publicPath= '../build/';
}
module.exports = config;