-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
42 lines (34 loc) · 1008 Bytes
/
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
'use strict';
//Depends
var _ = require('lodash');
/**
* Exported evnironments object
* @type {Object}
*/
var _configs = {
//global section
global: require(__dirname + '/config/webpack/global'),
//config by enviroments
production: require(__dirname + '/config/webpack/environments/production'),
development: require(__dirname + '/config/webpack/environments/development')
};
/**
* Load webpack config via enviroments
* @param {[type]} enviroment [description]
* @return {[type]} [description]
*/
var _load = function(environment) {
//check enviroment
if (!environment) throw 'Can\'t find local environment variable via process.env.NODE_ENV';
if (!_configs[environment]) throw 'Can\'t find enviroments see _congigs object';
//load config file by environment
return _configs && _.merge(
_configs['global'](__dirname),
_configs[environment](__dirname)
);
}
/**
* Export WebPack config
* @type {[type]}
*/
module.exports = _load(process.env.NODE_ENV);