-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.client.config.js
50 lines (47 loc) · 1.31 KB
/
webpack.client.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
require('./node_modules/dotenv').config();
const webpack = require('webpack');
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const client = {
entry: {
app: './client/js/main.js'
},
output: {
path: path.resolve(__dirname, 'build/client'),
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}]
},
resolve: {
modules: [
path.resolve(__dirname, 'client/js'),
path.resolve(__dirname, 'node_modules')
]
},
plugins: [
new HtmlWebpackPlugin({
template: './client/index.html'
}),
new webpack.DefinePlugin({
'COWS_URL': JSON.stringify(process.env.COWS_HOST + (process.env.COWS_PORT ? ':' + process.env.COWS_PORT : '')),
'COWS_PATH': JSON.stringify(process.env.COWS_PATH),
'DEBUG': process.env.NODE_ENV == 'development'
})
]
};
if (process.env.NODE_ENV == 'production') {
client.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
);
}
module.exports = client;