This commit is contained in:
2022-07-21 03:28:35 +00:00
parent d7c883d6df
commit 51b34b0e1d
30103 changed files with 4152204 additions and 23 deletions
+22
View File
@@ -0,0 +1,22 @@
import {errorMessage, isFunction, loadResources} from './utils';
import type {Loader, LoaderCallback} from '.';
const loader: Loader = function (source) {
this.cacheable();
const callback = this.async();
if (!isFunction<LoaderCallback>(callback)) {
throw new Error(errorMessage.syncCompilation);
}
/* istanbul ignore if: not possible to test */
if (typeof source !== 'string') {
throw new Error(errorMessage.impossible);
}
void loadResources(this, source, callback);
};
export default loader;