-
Notifications
You must be signed in to change notification settings - Fork 25
/
webpack.config.js
executable file
·66 lines (62 loc) · 1.39 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
var path = require('path')
, webpack = require('webpack')
, UglifyJSPlugin = require('uglifyjs-webpack-plugin')
require('dotenv').config()
var paths = {};
paths.BASE = path.join(__dirname, 'src', 'candis', 'app');
paths.APP = path.join(paths.BASE, 'client', 'app');
var config = require(path.join(paths.APP, 'config'));
module.exports = {
entry: [
path.join(paths.APP, 'Client.jsx'),
path.join(paths.APP, 'plugins.js')
],
output: {
path: path.join(paths.BASE, 'assets', 'js'),
filename: 'bundle.min.js',
publicPath: 'http://' + config.host + ':' + config.port
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /(node_modules)/
},
{
test: /\.json$/,
loader: 'json-loader'
}
]
},
plugins: process.env.NODE_ENV === 'development' ?
[
// debug plugins go here.
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development')
}
})
]
:
[
// production plugins go here.
new UglifyJSPlugin({
uglifyOptions: {
beautify: false,
ecma: 6,
compress: true,
comments: false
}
})
],
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.jsx', '.json']
},
node: {
net: 'empty',
tls: 'empty',
dns: 'empty'
}
};