Skip to content

Commit

Permalink
Use customConfig rules completely and also support custom resolveLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Apr 24, 2017
1 parent ff5c01b commit d01b097
Show file tree
Hide file tree
Showing 4 changed files with 249 additions and 244 deletions.
5 changes: 3 additions & 2 deletions dist/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ exports.default = function (configType, baseConfig, configDir) {
// We need to use our and custom plugins.
plugins: [].concat((0, _toConsumableArray3.default)(config.plugins), (0, _toConsumableArray3.default)(customConfig.plugins || [])),
module: (0, _extends3.default)({}, config.module, customConfig.module, {
rules: [].concat((0, _toConsumableArray3.default)(config.module.rules), (0, _toConsumableArray3.default)(customConfig.module.rules || []))
rules: customConfig.module.rules || config.module.rules
}),
resolve: (0, _extends3.default)({}, config.resolve, customConfig.resolve, {
alias: (0, _extends3.default)({}, config.alias, customConfig.resolve && customConfig.resolve.alias)
})
}),
resolveLoader: customConfig.resolveLoader || config.resolveLoader
});

return newConfig;
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2016": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"chai": "^3.5.0",
"deep-equal": "^1.0.1",
Expand Down
6 changes: 2 additions & 4 deletions src/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ export default function (configType, baseConfig, configDir) {
...config.module,
// We need to use our and custom rules.
...customConfig.module,
rules: [
...config.module.rules,
...customConfig.module.rules || [],
],
rules: customConfig.module.rules || config.module.rules,
},
resolve: {
...config.resolve,
Expand All @@ -85,6 +82,7 @@ export default function (configType, baseConfig, configDir) {
...(customConfig.resolve && customConfig.resolve.alias),
},
},
resolveLoader: customConfig.resolveLoader || config.resolveLoader,
};

return newConfig;
Expand Down
Loading

0 comments on commit d01b097

Please sign in to comment.