Skip to content

Commit

Permalink
chore: bundle optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 committed Aug 1, 2024
1 parent 91ead7d commit 8c84b24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/plugin-dts/src/dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function generateDts(data: DtsGenOptions) {
return distPath ? distPath : rawCompilerOptions.declarationDir ?? './dist';
};

const declarationDir = getDeclarationDir(bundle, distPath);
const declarationDir = getDeclarationDir(bundle!, distPath);
let entry = '';

if (bundle === true && entryPath) {
Expand Down
7 changes: 3 additions & 4 deletions packages/plugin-dts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { extname, join } from 'node:path';
import type { RsbuildPlugin } from '@rsbuild/core';

export type pluginDtsOptions = {
bundle: boolean;
bundle?: boolean;
distPath?: string;
tsconfigPath?: string;
entryPath?: string;
Expand All @@ -22,14 +22,13 @@ export const PLUGIN_DTS_NAME = 'rsbuild:dts';
// TODO: support incremental build, to build one or more projects and their dependencies
// TODO: support autoExtension for dts files
// TODO: deal alias in dts
export const pluginDts = (
options: pluginDtsOptions = { bundle: false },
): RsbuildPlugin => ({
export const pluginDts = (options: pluginDtsOptions): RsbuildPlugin => ({
name: PLUGIN_DTS_NAME,

setup(api) {
const config = api.getRsbuildConfig();

options.bundle = options.bundle ?? false;
options.distPath =
options.distPath ?? config.output?.distPath?.root ?? 'dist';

Expand Down

0 comments on commit 8c84b24

Please sign in to comment.