Skip to content

Commit

Permalink
fix(module-tools): add -b param to tsc when user add references
Browse files Browse the repository at this point in the history
  • Loading branch information
10Derozan committed Nov 29, 2023
1 parent 460e45c commit 0f2f4be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/proud-gifts-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modern-js/module-tools': patch
---

fix(module-tools): add -b param to tsc when user add references to avoid error ts6305
fix(module-tools): 用户使用 references 时给 tsc 添加 -b 参数来避免 TS6305 错误
16 changes: 13 additions & 3 deletions packages/solutions/module-tools/src/builder/dts/tsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,21 @@ const runTscBin = async (
) => {
const { appDirectory, watch = false, abortOnError = true } = config;

const { tempTsconfigPath } = info;
const { tempTsconfigPath, userTsconfig } = info;

const tscBinFile = await getTscBinPath(appDirectory);

const watchParams = watch ? ['-w'] : [];
const params: string[] = [];

if (watch) {
params.push('-w');
}

// avoid error TS6305
if (userTsconfig.references) {
params.push('-b');
}

const childProgress = execa(
tscBinFile,
[
Expand All @@ -79,7 +89,7 @@ const runTscBin = async (
'--pretty',
// https://github.com/microsoft/TypeScript/issues/21824
'--preserveWatchOutput',
...watchParams,
...params,
],
{
stdio: 'pipe',
Expand Down

0 comments on commit 0f2f4be

Please sign in to comment.