Skip to content

Commit 515ab45

Browse files
authored
fix(dts): should keep watch if bundle dts failed (#1156)
1 parent e60c4ba commit 515ab45

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/plugin-dts/src/apiExtractor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ export async function bundleDts(options: BundleOptions): Promise<void> {
106106
}),
107107
);
108108
} catch (e) {
109-
const error = new Error(`${logPrefixApiExtractor} ${e}`);
109+
const error = new Error(
110+
`${logPrefixApiExtractor} ${e} ${color.gray(`(${name})`)}`,
111+
);
110112
// do not log the stack trace, it is not helpful for users
111113
error.stack = '';
112114
throw error;

packages/plugin-dts/src/dts.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ export async function generateDts(data: DtsGenOptions): Promise<void> {
240240

241241
const onComplete = async (isSuccess: boolean) => {
242242
if (isSuccess) {
243-
await bundleDtsIfNeeded();
243+
try {
244+
await bundleDtsIfNeeded();
245+
} catch (e) {
246+
logger.error(e);
247+
}
244248
}
245249
};
246250

0 commit comments

Comments
 (0)