Skip to content

Commit 84e1072

Browse files
committed
Fix TypeStrong#949 and thereby nodeModulesMeaningfulErrorWhenImportingTs
1 parent 948cb35 commit 84e1072

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

src/servicesHost.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ export function makeServicesHost(
9696

9797
getProjectReferences: () => projectReferences,
9898

99-
getScriptFileNames: () =>
100-
[...files.keys()].filter(filePath => filePath.match(scriptRegex)),
99+
getScriptFileNames: () => Array.from(instance.rootFileNames),
101100

102101
getScriptVersion: (fileName: string) => {
103102
fileName = path.normalize(fileName);
@@ -351,7 +350,7 @@ export function makeWatchHost(
351350
return watchHost;
352351

353352
function getRootFileNames() {
354-
return [...files.keys()].filter(filePath => filePath.match(scriptRegex));
353+
return Array.from(instance.rootFileNames);
355354
}
356355

357356
function readFileWithCachingText(fileName: string, encoding?: string) {

src/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ export function isRootFileOrExempt(
259259
fileName: string,
260260
instance: TSInstance
261261
): boolean {
262-
if (instance.rootFileNames.has(fileName)) {
262+
// node_modules checking handled separately, later
263+
if (
264+
instance.rootFileNames.has(fileName) ||
265+
fileName.indexOf('node_modules') > -1
266+
) {
263267
return true;
264268
}
265269

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"compilerOptions": {
3-
},
4-
"files": [
5-
"index.vue.ts"
6-
]
3+
}
74
}
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
{
2-
"compilerOptions": {
3-
"include": [
4-
"node_modules",
5-
"app.ts"
6-
]
7-
}
8-
}
1+
{}

0 commit comments

Comments
 (0)