This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/url-loader/dist/utils/normalizeFallback.js
2019-08-11 20:48:02 +02:00

38 lines
No EOL
898 B
JavaScript

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = normalizeFallback;
var _loaderUtils = require('loader-utils');
var _loaderUtils2 = _interopRequireDefault(_loaderUtils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function normalizeFallback(fallback, originalOptions) {
let loader = 'file-loader';
let options = {};
if (typeof fallback === 'string') {
loader = fallback;
const index = fallback.indexOf('?');
if (index >= 0) {
loader = fallback.substr(0, index);
options = _loaderUtils2.default.parseQuery(fallback.substr(index));
}
}
if (fallback !== null && typeof fallback === 'object') {
({ loader, options } = fallback);
}
options = Object.assign({}, originalOptions, options);
delete options.fallback;
return { loader, options };
}