@wjunt/webpack-config
Version:
Presets of webpack config
27 lines (26 loc) • 1.19 kB
TypeScript
import { RuleSetRule, RuleSetUse, RuleSetUseItem } from 'webpack';
export interface CacheLoaderOptions {
cacheContext?: string;
cacheKey?: (options: CacheLoaderOptions, request: string) => string;
cacheDirectory: string;
cacheIdentifier: string;
write?: (cacheKey: string, data: any, callback: (err: null | Error) => void) => void;
read?: (cacheKey: string, callback: (err: null | Error, data?: any) => void) => void;
}
/**
* Get cache-loader for caching.
* @param options
*/
export declare function getCacheLoader(options?: true | Partial<CacheLoaderOptions>): RuleSetUseItem;
export declare type SimpleRuleSetRule = Pick<RuleSetRule, 'test' | 'include' | 'exclude'>;
export declare type RuleSetUseWithoutFunction = Exclude<RuleSetUse, Function>;
export declare type RuleSetRuleWithStrategy = SimpleRuleSetRule & {
cacheable?: boolean | Partial<CacheLoaderOptions>;
options?: any;
use?: RuleSetUseWithoutFunction;
useAppend?: RuleSetUseWithoutFunction;
usePrepend?: RuleSetUseWithoutFunction;
};
export declare function combineRule(rule: RuleSetRuleWithStrategy, defaults: RuleSetRule & {
use?: RuleSetUseWithoutFunction;
}): RuleSetRule;