forked from HelpfulHuman/React-Project-LEGACY-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·45 lines (41 loc) · 1.1 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
require('dotenv').load();
process.env.BABEL_ENV = process.env.APP_ENV;
var path = require('path');
var webpack = require('webpack');
var APP_ENV = process.env.APP_ENV;
var port = process.env.PORT || 9700;
var config = {
entry: [ path.resolve(__dirname, 'src/index.js') ],
output: {
path: path.resolve(__dirname, 'build'),
publicPath: '/',
filename: 'app.js'
},
resolve: ['', '.js', '.jsx'],
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
include: path.resolve(__dirname, 'src')
}
]
},
plugins: [
new webpack.DefinePlugin({
// inject "env" as a global variable
env: JSON.stringify({
API_HOST: process.env.API_HOST || null
})
})
]
}
// development specific configurations here
if (APP_ENV !== 'production') {
config['debug'] = true;
config['devtool'] = 'eval-cheap-module-source-map';
config['entry'].unshift('webpack-hot-middleware/client?reload=true');
config['plugins'].push(new webpack.HotModuleReplacementPlugin());
config['plugins'].push(new webpack.NoErrorsPlugin());
}
module.exports = config;