Fixed singleton loading problems from webpack config.

This commit is contained in:
Chris
2016-03-29 14:11:12 +02:00
parent ce025c4116
commit 45b31f0227
2 changed files with 5 additions and 11 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
## 1.5.3: ## 1.5.3:
1. Asset paths are now relative (makes it easier to use bundles in subdirectories) 1. Asset paths are now relative (makes it easier to use bundles in subdirectories)
2. Removed loading problems for webpack configurations overriding (see https://github.com/newtriks/generator-react-webpack/issues/194)
## 1.5.2: ## 1.5.2:
@@ -10,7 +11,7 @@
## 1.5.1: ## 1.5.1:
1. Emergency fix for corruct eslint version (2.3 is currently buggy). Fixes https://github.com/newtriks/generator-react-webpack/issues/196 1. Emergency fix for correct eslint version (2.3 is currently buggy). Fixes https://github.com/newtriks/generator-react-webpack/issues/196
2. Added mocha to eslint global config as requested in https://github.com/newtriks/generator-react-webpack/issues/195 2. Added mocha to eslint global config as requested in https://github.com/newtriks/generator-react-webpack/issues/195
## 1.5.0: ## 1.5.0:
+3 -10
View File
@@ -8,7 +8,7 @@ const allowedEnvs = ['dev', 'dist', 'test'];
// Set the correct environment // Set the correct environment
var env; var env;
if(args._.length > 0 && args._.indexOf('start') !== -1) { if (args._.length > 0 && args._.indexOf('start') !== -1) {
env = 'test'; env = 'test';
} else if (args.env) { } else if (args.env) {
env = args.env; env = args.env;
@@ -17,14 +17,6 @@ if(args._.length > 0 && args._.indexOf('start') !== -1) {
} }
process.env.REACT_WEBPACK_ENV = env; process.env.REACT_WEBPACK_ENV = env;
// Get available configurations
const configs = {
base: require(path.join(__dirname, 'cfg/base')),
dev: require(path.join(__dirname, 'cfg/dev')),
dist: require(path.join(__dirname, 'cfg/dist')),
test: require(path.join(__dirname, 'cfg/test'))
};
/** /**
* Build the webpack configuration * Build the webpack configuration
* @param {String} wantedEnv The wanted environment * @param {String} wantedEnv The wanted environment
@@ -33,7 +25,8 @@ const configs = {
function buildConfig(wantedEnv) { function buildConfig(wantedEnv) {
let isValid = wantedEnv && wantedEnv.length > 0 && allowedEnvs.indexOf(wantedEnv) !== -1; let isValid = wantedEnv && wantedEnv.length > 0 && allowedEnvs.indexOf(wantedEnv) !== -1;
let validEnv = isValid ? wantedEnv : 'dev'; let validEnv = isValid ? wantedEnv : 'dev';
return configs[validEnv]; let config = require(path.join(__dirname, 'cfg/' + validEnv));
return config;
} }
module.exports = buildConfig(env); module.exports = buildConfig(env);