Skip to content

Commit

Permalink
Fix #905
Browse files Browse the repository at this point in the history
Ensure that json files are resolved if resolveJsonModule flag is set in tsconfig
  • Loading branch information
berickson1 committed May 6, 2020
1 parent bbc6d81 commit 7df8148
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/instances.ts
Expand Up @@ -351,6 +351,13 @@ export function initializeInstance(
}

function getScriptRegexp(instance: TSInstance) {
// If resolveJsonModules is set, we should accept json files
if (instance.configParseResult.options.resolveJsonModule) {
// if allowJs is set then we should accept js(x) files
return instance.configParseResult.options.allowJs === true
? /\.tsx?$|\.json$|\.jsx?$/i
: /\.tsx?$|\.json$/i;
}
// if allowJs is set then we should accept js(x) files
return instance.configParseResult.options.allowJs === true
? /\.tsx?$|\.jsx?$/i
Expand Down

0 comments on commit 7df8148

Please sign in to comment.