style-resources-loader
Version:
CSS processor resources loader for webpack
23 lines (15 loc) • 548 B
text/typescript
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;