Skip to content

Commit 45b31f0

Browse files
committed
Fixed singleton loading problems from webpack config.
1 parent ce025c4 commit 45b31f0

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
## 1.5.3:
44

55
1. Asset paths are now relative (makes it easier to use bundles in subdirectories)
6+
2. Removed loading problems for webpack configurations overriding (see https://github.com/newtriks/generator-react-webpack/issues/194)
67

78
## 1.5.2:
89

910
1. Updated dependencies to latests (babel-eslint, eslint, karma-mocha-reporter, normalize.css)
1011

1112
## 1.5.1:
1213

13-
1. Emergency fix for corruct eslint version (2.3 is currently buggy). Fixes https://github.com/newtriks/generator-react-webpack/issues/196
14+
1. Emergency fix for correct eslint version (2.3 is currently buggy). Fixes https://github.com/newtriks/generator-react-webpack/issues/196
1415
2. Added mocha to eslint global config as requested in https://github.com/newtriks/generator-react-webpack/issues/195
1516

1617
## 1.5.0:

webpack.config.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const allowedEnvs = ['dev', 'dist', 'test'];
88

99
// Set the correct environment
1010
var env;
11-
if(args._.length > 0 && args._.indexOf('start') !== -1) {
11+
if (args._.length > 0 && args._.indexOf('start') !== -1) {
1212
env = 'test';
1313
} else if (args.env) {
1414
env = args.env;
@@ -17,14 +17,6 @@ if(args._.length > 0 && args._.indexOf('start') !== -1) {
1717
}
1818
process.env.REACT_WEBPACK_ENV = env;
1919

20-
// Get available configurations
21-
const configs = {
22-
base: require(path.join(__dirname, 'cfg/base')),
23-
dev: require(path.join(__dirname, 'cfg/dev')),
24-
dist: require(path.join(__dirname, 'cfg/dist')),
25-
test: require(path.join(__dirname, 'cfg/test'))
26-
};
27-
2820
/**
2921
* Build the webpack configuration
3022
* @param {String} wantedEnv The wanted environment
@@ -33,7 +25,8 @@ const configs = {
3325
function buildConfig(wantedEnv) {
3426
let isValid = wantedEnv && wantedEnv.length > 0 && allowedEnvs.indexOf(wantedEnv) !== -1;
3527
let validEnv = isValid ? wantedEnv : 'dev';
36-
return configs[validEnv];
28+
let config = require(path.join(__dirname, 'cfg/' + validEnv));
29+
return config;
3730
}
3831

3932
module.exports = buildConfig(env);

0 commit comments

Comments
 (0)