Skip to content

Commit

Permalink
fix: rootDir in bundle DTS
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 committed Aug 12, 2024
1 parent f533fbb commit de8d0f3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions e2e/cases/dts/bundle-false/__fixtures__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "@rslib/tsconfig/base",
"compilerOptions": {
"baseUrl": "./",
"rootDir": "src"
"baseUrl": "./"
},
"include": ["src"]
}
3 changes: 1 addition & 2 deletions e2e/cases/dts/bundle-false/abort-on-error/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "@rslib/tsconfig/base",
"compilerOptions": {
"baseUrl": "./",
"rootDir": "src"
"baseUrl": "./"
},
"include": ["src"]
}
3 changes: 1 addition & 2 deletions e2e/cases/dts/bundle/__fixtures__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "@rslib/tsconfig/base",
"compilerOptions": {
"baseUrl": "./",
"rootDir": "src"
"baseUrl": "./"
},
"include": ["src"]
}
3 changes: 1 addition & 2 deletions e2e/cases/dts/bundle/abort-on-error/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "@rslib/tsconfig/base",
"compilerOptions": {
"baseUrl": "./",
"rootDir": "src"
"baseUrl": "./"
},
"include": ["src"]
}
4 changes: 2 additions & 2 deletions packages/plugin-dts/src/dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export async function generateDts(data: DtsGenOptions): Promise<void> {
throw new Error();
}
const { options: rawCompilerOptions } = loadTsconfig(configPath);
const rootDir = rawCompilerOptions.rootDir ?? 'src';
const rootDir =
rawCompilerOptions.rootDir ?? join(dirname(configPath), 'src');
const outDir = distPath
? distPath
: rawCompilerOptions.declarationDir || './dist';
Expand Down Expand Up @@ -81,7 +82,6 @@ export async function generateDts(data: DtsGenOptions): Promise<void> {
name,
cwd,
configPath,
rootDir,
declarationDir,
dtsExtension,
},
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-dts/src/tsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export type EmitDtsOptions = {
name: string;
cwd: string;
configPath: string;
rootDir: string;
declarationDir: string;
dtsExtension: string;
};
Expand Down

0 comments on commit de8d0f3

Please sign in to comment.