Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(module-tools): add -b param to tsc when user add references #5013

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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