Skip to content

Commit e1dd3b3

Browse files
committed
docs: fix defineConfig type hint
docs: fix defineConfig type hint
1 parent b45f124 commit e1dd3b3

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

packages/core/src/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ export function composeDecoratorsConfig(
502502
}
503503

504504
export async function createConstantRsbuildConfig(): Promise<EnvironmentConfig> {
505+
// When the default configuration is inconsistent with rsbuild, remember to modify the type hints
506+
// see https://github.com/web-infra-dev/rslib/discussions/856
505507
return defineRsbuildConfig({
506508
dev: {
507509
progressBar: false,

packages/core/src/types/config.ts

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import type { EnvironmentConfig, RsbuildConfig, Rspack } from '@rsbuild/core';
1+
import type {
2+
EnvironmentConfig,
3+
OutputConfig,
4+
RsbuildConfig,
5+
Rspack,
6+
} from '@rsbuild/core';
27
import type { GetAsyncFunctionFromUnion } from './utils';
38

49
export type Format = 'esm' | 'cjs' | 'umd' | 'mf';
@@ -303,8 +308,33 @@ export interface LibConfig extends EnvironmentConfig {
303308

304309
export type LibOnlyConfig = Omit<LibConfig, keyof EnvironmentConfig>;
305310

311+
interface RslibOutputConfig extends OutputConfig {
312+
/**
313+
* @override
314+
* @default 'node'
315+
*/
316+
target?: OutputConfig['target'];
317+
/**
318+
* @override
319+
* @default false
320+
*/
321+
filenameHash?: OutputConfig['filenameHash'];
322+
/**
323+
* @override
324+
* When minify is not specified, Rslib will use a sane default for minify options.
325+
* The default options will only perform dead code elimination and unused code elimination.
326+
*
327+
* detail: {@link https://lib.rsbuild.dev/config/rsbuild/output#outputminify rsbuild-outputminify}
328+
*/
329+
minify?: OutputConfig['minify'];
330+
}
331+
306332
export interface RslibConfig extends RsbuildConfig {
307333
lib: LibConfig[];
334+
/**
335+
* @inheritdoc
336+
*/
337+
output?: RslibOutputConfig;
308338
}
309339

310340
export type ConfigParams = {

0 commit comments

Comments
 (0)