-
Notifications
You must be signed in to change notification settings - Fork 22
/
webpack.config.dev.js
83 lines (80 loc) · 2.09 KB
/
webpack.config.dev.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
74
75
76
77
78
79
80
81
82
83
var path = require('path');
var webpack = require('webpack');
var devFlagPlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
});
module.exports = {
// or devtool: 'eval' to debug issues with compiled output:
// devtool: 'cheap-module-eval-source-map',
devtool: 'source-map',
entry: [
// necessary for hot reloading with IE:
'eventsource-polyfill',
// listen to code updates emitted by hot middleware:
'webpack-hot-middleware/client',
// your code:
'./src/index'
],
target: 'node',
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/dist/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.ProvidePlugin({
React: 'react',
electron: 'electron'
}),
devFlagPlugin
],
// node: {
// child_process: 'empty'
// },
module: {
loaders: [
{
test: /\.js$/,
// loaders: ['babel'],
include: path.join(__dirname, 'src'),
loader: require.resolve('babel-loader'),
queries: {
plugins: ['transform-runtime'],
presets: ["react", "es2015", "babel-preset-stage-0"],
},
exclude: /node_modules/
},
{
test: /\.less$/,
loader: 'style!css!less',
exclude: /node_modules/
}
]
},
resolve: {
root: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules')
],
extensions: ['', '.js', '.min.js', '.json'],
modulesDirectories: ['node_modules', path.resolve(__dirname, 'src'), path.resolve(__dirname, 'node_modules')]
},
resolveLoader: {
modulesDirectories: ['node_modules', path.join(__dirname, '../node_modules')],
},
externals: [
(function () {
var IGNORES = [
'electron'
];
return function (context, request, callback) {
if (IGNORES.indexOf(request) >= 0) {
return callback(null, "require('" + request + "')");
}
return callback();
};
})()
]
};