Skip to content

Commit

Permalink
Fix TypeStrong#949 and thereby nodeModulesMeaningfulErrorWhenImportingTs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed Jun 10, 2019
1 parent 948cb35 commit 84e1072
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/servicesHost.ts
Expand Up @@ -96,8 +96,7 @@ export function makeServicesHost(

getProjectReferences: () => projectReferences,

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

getScriptVersion: (fileName: string) => {
fileName = path.normalize(fileName);
Expand Down Expand Up @@ -351,7 +350,7 @@ export function makeWatchHost(
return watchHost;

function getRootFileNames() {
return [...files.keys()].filter(filePath => filePath.match(scriptRegex));
return Array.from(instance.rootFileNames);
}

function readFileWithCachingText(fileName: string, encoding?: string) {
Expand Down
6 changes: 5 additions & 1 deletion src/utils.ts
Expand Up @@ -259,7 +259,11 @@ export function isRootFileOrExempt(
fileName: string,
instance: TSInstance
): boolean {
if (instance.rootFileNames.has(fileName)) {
// node_modules checking handled separately, later
if (
instance.rootFileNames.has(fileName) ||
fileName.indexOf('node_modules') > -1
) {
return true;
}

Expand Down
5 changes: 1 addition & 4 deletions test/comparison-tests/appendSuffixTo/tsconfig.json
@@ -1,7 +1,4 @@
{
"compilerOptions": {
},
"files": [
"index.vue.ts"
]
}
}
@@ -1,8 +1 @@
{
"compilerOptions": {
"include": [
"node_modules",
"app.ts"
]
}
}
{}

0 comments on commit 84e1072

Please sign in to comment.