Skip to content

Commit f2789d9

Browse files
committed
fix(tsc): remove exit early condition
close #4231
1 parent 32b7c72 commit f2789d9

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

packages/tsc/index.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,7 @@ export function run() {
2222
) {
2323
const writeFile = options.host!.writeFile.bind(options.host);
2424
options.host!.writeFile = (fileName, contents, ...args) => {
25-
if (
26-
fileName.endsWith('.d.ts')
27-
&& vueLanguagePlugin
28-
.getCanonicalFileName(fileName.replace(windowsPathReg, '/'))
29-
.slice(0, -5) === vueLanguagePlugin.pluginContext.globalTypesHolder
30-
) {
31-
contents = removeEmitGlobalTypes(contents);
32-
}
25+
contents = removeEmitGlobalTypes(contents);
3326
return writeFile(fileName, contents, ...args);
3427
};
3528
const vueLanguagePlugin = vue.createVueLanguagePlugin(
@@ -66,6 +59,8 @@ export function run() {
6659
}
6760
}
6861

62+
const removeEmitGlobalTypesRegexp = /[^\n]*__VLS_globalTypesStart[\w\W]*__VLS_globalTypesEnd[^\n]*\n/g;
63+
6964
export function removeEmitGlobalTypes(dts: string) {
70-
return dts.replace(/[^\n]*__VLS_globalTypesStart[\w\W]*__VLS_globalTypesEnd[^\n]*\n/, '');
65+
return dts.replace(removeEmitGlobalTypesRegexp, '');
7166
}

0 commit comments

Comments
 (0)