Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
fix: reference dts generate failed in dev mode (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Jul 10, 2022
1 parent 3ca8a0c commit a54003a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/builder/bundless/dts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,17 @@ export default async function getDeclarations(
const tsHost = ts.createCompilerHost(tsconfig.options);

tsHost.writeFile = (fileName, declaration, _a, _b, sourceFiles) => {
output.push({
file: path.basename(fileName),
content: declaration,
sourceFile: sourceFiles![0].fileName,
});
const sourceFile = sourceFiles![0].fileName;

// only collect dts for input files, to avoid output error in watch mode
// ref: https://github.com/umijs/father-next/issues/43
if (inputFiles.includes(sourceFile)) {
output.push({
file: path.basename(fileName),
content: declaration,
sourceFile,
});
}
};

const program = ts.createProgram(
Expand Down

0 comments on commit a54003a

Please sign in to comment.