Skip to content

Commit 6453a7f

Browse files
authored
fix(dts): fix @farmfe/js-plugin-dts doesn't emit d.ts files (#2146)
* fix(dts): fix `@farmfe/js-plugin-dts` doesn't create `d.ts` file in specific OS - relate #2145 * fix: ci
1 parent 452ab57 commit 6453a7f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

.changeset/slimy-banks-press.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@farmfe/js-plugin-dts": patch
3+
---
4+
5+
fix dts file creation

js-plugins/dts/src/context.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,15 @@ export default class Context {
158158
service
159159
.getEmitOutput(sourceFile, true)
160160
.getOutputFiles()
161-
.filter((outputFile) =>
162-
outputFile.compilerObject.name.startsWith(this.options.root)
163-
)
161+
.filter((outputFile) => {
162+
const outputPath = outputFile.compilerObject.name.replace(
163+
/\\/g,
164+
'/'
165+
);
166+
const rootPath = this.options.root.replace(/\\/g, '/');
167+
168+
return outputPath.startsWith(rootPath);
169+
})
164170
.map((outputFile) => ({
165171
path: resolve(
166172
this.options.root,

0 commit comments

Comments
 (0)