UNPKG

@wjunt/webpack-config

Version:

Presets of webpack config

84 lines (83 loc) 2.15 kB
import { Configuration } from 'webpack'; import { RuleSetRuleWithStrategy } from './common'; export interface ParsedImport { url: string; media: string; } export interface CssModuleOptions { /** * @default 'local' */ mode?: 'local' | 'global' | string; /** * @default '[hash:base64]' * @example * - use '[path][name]__[local]' for development. * - use '[hash:base64]' for production. */ localIdentName?: string; context?: string; hashPrefix?: string; getLocalIdent?: (context: string, localIdentName: string, localName: string, options: any) => string; localIdentRegExp?: string | RegExp; } export interface CSSLoaderOptions { url?: boolean | ((url: string, resourcePath: string) => boolean); import?: boolean | ((parsedImport: ParsedImport, resourcePath: string) => boolean); modules?: boolean | CssModuleOptions['mode'] | string | CssModuleOptions; sourceMap?: boolean; importLoaders?: number; /** * @default 'asIs' */ localsConvention?: 'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | string; onlyLocals?: boolean; esModule?: boolean; } export interface Px2remOptions { /** * @default 2 */ baseDpr?: number; /** * @default 75 */ remUnit?: number; /** * @default 6 */ remPrecision?: number; /** * @default 'px' */ forcePxComment?: string; /** * @default 'no' */ keepComment?: string; } export interface CSSRule extends RuleSetRuleWithStrategy { options?: CSSLoaderOptions; px2rem?: Px2remOptions | boolean; modules?: CSSLoaderOptions['modules']; esModule?: boolean; } /** * Support importing CSS. * @example * // Use default options. * module.exports = merge({ * css(), * { ...others }, * }); * @example * // Use less-loader. * module.exports = merge({ * css({ * test: /\.(less|css)$/, * 'use.append': ['less-loader'], * }), * { ...others }, * }); */ export declare function css({ modules, esModule, px2rem, ...rule }?: CSSRule): Configuration;