UNPKG

1.28 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = mergeCustomConfig;
7
8require("core-js/modules/es6.array.from");
9
10require("core-js/modules/es6.symbol");
11
12require("core-js/modules/web.dom.iterable");
13
14var _fs = require("fs");
15
16function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
17
18function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
19
20function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
21
22function _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; } }
23
24function mergeCustomConfig(webpackConfig, customConfigPath) {
25 if (!(0, _fs.existsSync)(customConfigPath)) {
26 return webpackConfig;
27 }
28
29 var customConfig = require(customConfigPath);
30
31 if (typeof customConfig === 'function') {
32 return customConfig.apply(void 0, [webpackConfig].concat(_toConsumableArray(Array.prototype.slice.call(arguments).slice(2))));
33 }
34
35 throw new Error("Return of ".concat(customConfigPath, " must be a function."));
36}
\No newline at end of file