Skip to content

Commit be40061

Browse files
fix: override default values of some type descriptions (#857)
Co-authored-by: Timeless0911 <[email protected]>
1 parent 1f52eeb commit be40061

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

packages/core/src/config.ts

Lines changed: 2 additions & 0 deletions
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

Lines changed: 35 additions & 1 deletion
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';
@@ -299,12 +304,41 @@ export interface LibConfig extends EnvironmentConfig {
299304
* @see {@link https://lib.rsbuild.dev/config/lib/out-base}
300305
*/
301306
outBase?: string;
307+
/**
308+
* @inheritdoc
309+
*/
310+
output?: RslibOutputConfig;
302311
}
303312

304313
export type LibOnlyConfig = Omit<LibConfig, keyof EnvironmentConfig>;
305314

315+
interface RslibOutputConfig extends OutputConfig {
316+
/**
317+
* @override
318+
* @default 'node'
319+
*/
320+
target?: OutputConfig['target'];
321+
/**
322+
* @override
323+
* @default false
324+
*/
325+
filenameHash?: OutputConfig['filenameHash'];
326+
/**
327+
* @override
328+
* When minify is not specified, Rslib will use a sane default for minify options.
329+
* The default options will only perform dead code elimination and unused code elimination.
330+
*
331+
* @see {@link https://lib.rsbuild.dev/config/rsbuild/output#outputminify}
332+
*/
333+
minify?: OutputConfig['minify'];
334+
}
335+
306336
export interface RslibConfig extends RsbuildConfig {
307337
lib: LibConfig[];
338+
/**
339+
* @inheritdoc
340+
*/
341+
output?: RslibOutputConfig;
308342
}
309343

310344
export type ConfigParams = {

0 commit comments

Comments
 (0)