import type { RspackOptions as RspackConfiguration } from '@rspack/core'; import type SassLoader from '../../compiled/sass-loader/index.js'; import type { AcceptedPlugin, ProcessOptions } from 'postcss'; import type { Configuration as WebpackConfiguration } from 'webpack'; import type { ChunkSplit } from './chunkSplit'; import type { LightningcssMinifyPluginOptions, LightningcssTransformOptions } from './lightningcss'; import type { UnpackPlugin } from './plugin'; export type BundlerConfiguration = RspackConfiguration | WebpackConfiguration; type PostCSSOptions = ProcessOptions & { /** * @default true * Allows to set options using config files. * Options specified in the config file are combined with options passed to the loader, the loader options overwrite options from config. */ config?: boolean | string; plugins?: AcceptedPlugin[]; }; type BundlerConfig = BundlerConfiguration | ((config: BundlerConfiguration, utils: { mergeConfig: (...configs: BundlerConfiguration[]) => BundlerConfiguration; bundler: UnpackConfig['bundler']; }) => Promise | BundlerConfiguration); export type UnpackConfig = { /** * @default "rspack" */ bundler?: 'webpack' | 'rspack'; /** * @default process.cwd() */ root?: string; entry?: string; define?: Record; externals?: BundlerConfiguration['externals']; css?: { /** * @default "postcss" */ transformer?: 'postcss' | 'lightningcss'; /** * @default false */ sourceMap?: boolean; /** * @default true - enable CSS Modules for files matching `/\.module\.\w+$/i.test(filename)` regexp. */ modules?: boolean | { /** * `undefined` or `true` - enable CSS Modules for files matching `/\.module\.\w+$/i.test(filename)` regexp. * `false` - disable CSS Modules. * `RegExp` - enable CSS modules for files matching `/RegExp/i.test(filename)` regexp. * `function` - enable CSS Modules for files based on the filename satisfying your filter function check. */ auto?: boolean | RegExp | ((resourcePath: string) => boolean); localIdentName?: string; }; postcss?: PostCSSOptions | ((loaderContext: any) => PostCSSOptions); lightningcss?: LightningcssTransformOptions; less?: Less.Options; sass?: SassLoader.Options['sassOptions']; }; resolve?: { alias?: Record; extensions?: string[]; }; server?: { host?: string; /** * @default 3000 */ port?: number; /** * @default false */ open?: boolean | string; proxy?: BundlerConfiguration['devServer']['proxy']; }; build?: { /** * @default "dist" */ outDir?: string; copy?: Array<{ from: string; to?: string; }>; /** * Whether to enable minification. * By default, it is set to `true` in production and `false` in development. */ minify?: boolean | { lightningcss?: LightningcssMinifyPluginOptions; }; /** * By default, it is set to `false` in production and `cheap-module-source-map` in development. */ sourceMap?: BundlerConfiguration['devtool']; /** * Speed up build with `thread-loader`. * @default true */ parallel?: boolean; /** * Whether to enable `filesystem` cache. * @default false */ cache?: boolean; publicPath?: string; /** * Whether to enable filename hash in production. * @default true */ filenameHash?: boolean; }; html?: { /** * @default "root" */ mountId?: string; title?: string | ((params: { entryName: string; }) => string); /** * webpack relative or absolute path to the template. */ template?: string; /** * Can be used instead of template to provide an inline template. */ templateContent?: string | ((params: Record) => string); /** * Allows to overwrite the parameters used in the template. */ templateParameters?: Record; headTag?: string; }; bundlerConfig?: BundlerConfig; performance?: { /** * Analyze the size of output files. * @default false */ bundleAnalyze?: boolean; /** * Whether to remove the locales of [moment.js](https://momentjs.com/). * @default false */ removeMomentLocale?: boolean; /** * Configure the chunk splitting strategy. */ chunkSplit?: ChunkSplit; }; experiments?: { /** * @default false */ css?: boolean; }; mpa?: boolean | { /** * Global imports to be added to all entries. */ globalImport?: string[]; /** * Whether to use lower case for entry names. */ lowerCase?: boolean; /** * Layout component to be used for all entries. */ layout?: string; }; plugins?: UnpackPlugin[]; }; export {}; //# sourceMappingURL=config.d.ts.map