UNPKG

1.22 kBJavaScriptView Raw
1import "core-js/modules/es6.array.from";
2import "core-js/modules/es6.symbol";
3import "core-js/modules/web.dom.iterable";
4import "core-js/modules/es6.array.is-array";
5
6function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
7
8function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
9
10function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
11
12function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
13
14import { existsSync } from 'fs';
15export default function mergeCustomConfig(webpackConfig, customConfigPath) {
16 if (!existsSync(customConfigPath)) {
17 return webpackConfig;
18 }
19
20 var customConfig = require(customConfigPath);
21
22 if (typeof customConfig === 'function') {
23 return customConfig.apply(void 0, [webpackConfig].concat(_toConsumableArray(Array.prototype.slice.call(arguments).slice(2))));
24 }
25
26 throw new Error("Return of ".concat(customConfigPath, " must be a function."));
27}
\No newline at end of file