import { MinifyOptions } from 'terser'; import { Options } from '@swc/core'; import { TransformOptions } from 'esbuild'; import { ServerOptions } from 'https'; import { RsbuildConfig } from '@rsbuild/core'; type UserConfigType = { /** * output directory * @type {string} * @default dist */ distDir: string; /** * loader config */ loader: { babel: { /** * enable * @default true */ enable: boolean; options: Record; }; less: { /** * enable * @default true */ enable: boolean; options: Record; }; sass: { /** * enable * @default true */ enable: boolean; options: Record; }; stylus: { /** * enable * @default true */ enable: boolean; options: Record; }; postcss: { /** * enable * @default true */ enable: boolean; options: Record; }; swc: { /** * enable * @default false */ enable: boolean; options: Options; }; esbuild: { /** * enable * @default false */ enable: boolean; options: TransformOptions; }; }; /** * plugin config */ plugin: { /** * eslint-webpack-plugin config */ eslint: { /** * enable * @default true */ enable: boolean; options: Record; }; /** * stylelint-webpack-plugin config */ stylelint: { /** * enable * @default true */ enable: boolean; options: Record; }; /** * fork-ts-checker-webpack-plugin config */ typescript: { /** * enable * @default true */ enable: boolean; options: Record; }; }; /** * webpack optimization config */ optimization: { /** * webpack optimization config */ splitChunks: any; /** * webpack minimizer config */ minimizer: { /** * jsMinimizer config */ jsMinimizer: { /** * minify * @default 'terserMinify' */ minify: 'terserMinify' | 'uglifyJsMinify' | 'esbuildMinify' | 'swcMinify'; terserOptions: MinifyOptions; }; /** * cssMinimizer config */ cssMinimizer: { /** * minify * @default 'cssnanoMinify' */ minify: 'cssnanoMinify' | 'cssoMinify' | 'cleanCssMinify' | 'esbuildMinify' | 'lightningCssMinify' | 'swcMinify'; minimizerOptions: Record; }; }; }; /** * webpack server config */ server: { /** * https config * @default undefined */ https: ServerOptions | undefined; }; }; declare const userDefaultWebpackConfig: UserConfigType; type WebpackConfig = { /** * output directory * @type {string} * @default dist */ distDir?: string; /** * loader config */ loader?: { babel?: { /** * enable * @default true */ enable: boolean; options?: Record; }; less?: { /** * enable * @default true */ enable: boolean; options?: Record; }; sass?: { /** * enable * @default true */ enable: boolean; options?: Record; }; stylus?: { /** * enable * @default true */ enable: boolean; options?: Record; }; postcss?: { /** * enable * @default true */ enable: boolean; options?: Record; }; swc?: { /** * enable * @default false */ enable: boolean; options?: Options; }; esbuild?: { /** * enable * @default false */ enable: boolean; options?: TransformOptions; }; }; /** * plugin config */ plugin?: { /** * eslint-webpack-plugin config */ eslint?: { /** * enable * @default true */ enable: boolean; options?: Record; }; /** * stylelint-webpack-plugin config */ stylelint?: { /** * enable * @default true */ enable: boolean; options?: Record; }; /** * fork-ts-checker-webpack-plugin config */ typescript?: { /** * enable * @default true */ enable: boolean; options?: Record; }; }; /** * webpack optimization config */ optimization?: { /** * webpack optimization config */ splitChunks?: any; /** * webpack minimizer config */ minimizer?: { /** * jsMinimizer config */ jsMinimizer?: { /** * minify * @default 'terserMinify' */ minify: 'terserMinify' | 'uglifyJsMinify' | 'esbuildMinify' | 'swcMinify'; terserOptions?: MinifyOptions; }; /** * cssMinimizer config */ cssMinimizer?: { /** * minify * @default 'cssnanoMinify' */ minify: 'cssnanoMinify' | 'cssoMinify' | 'cleanCssMinify' | 'esbuildMinify' | 'lightningCssMinify' | 'swcMinify'; minimizerOptions?: Record; }; }; }; /** * webpack server config */ server?: { /** * https config * @default undefined */ https: ServerOptions | undefined; }; }; declare function defineConfig(config: WebpackConfig | RsbuildConfig): WebpackConfig | RsbuildConfig; export { type UserConfigType, defineConfig, userDefaultWebpackConfig };