webpack-genius
Version:
**For chinese developers:** you'd better add taobao mirror before everything start. Or you may fail to install. ```bash yarn config set registry http://registry.npm.taobao.org ```
28 lines (27 loc) • 1.26 kB
TypeScript
import { WebpackGenius } from '../WebpackGenius';
import { RuleSetRule, RuleSetCondition, RuleSetLoader } from 'webpack';
export declare abstract class RuleHandle<T = any> {
protected readonly genius: WebpackGenius;
private status;
protected rule: RuleSetRule & {
use?: RuleSetLoader[];
};
constructor(genius: WebpackGenius);
protected onInit(): void;
removeLoader(name: string): this;
addLoaderBefore(loader: RuleSetLoader, beforeLoaderName?: string): this;
addLoaderAfter(loader: RuleSetLoader, afterLoaderName?: string): this;
enable(enable: boolean): this;
isUsed(): boolean;
setInclude(value: RuleSetCondition): this;
setExclude(value: RuleSetCondition): this;
setOptions<U extends keyof T>(loaderName: U, fn: (options: Partial<T[U]>) => Partial<T[U]> | void): this;
disableLoader(loaderName: keyof T): this;
protected abstract test(): RuleSetCondition;
protected abstract loaders(): RuleSetLoader[];
protected exclude(): RuleSetCondition | undefined;
protected include(): RuleSetCondition | undefined;
protected collect(): RuleSetRule;
protected exists(loader?: string): boolean;
protected isLoaderEqual(loader?: string, search?: keyof T | string): boolean;
}