UNPKG

style-resources-loader

Version:
23 lines (15 loc) 548 B
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;