diff --git a/src/after-compile.ts b/src/after-compile.ts index 97db8dd39..3dace35d6 100644 --- a/src/after-compile.ts +++ b/src/after-compile.ts @@ -124,9 +124,12 @@ function provideErrorsToWebpack( modules: Modules, instance: interfaces.TSInstance ) { - const { compiler, languageService, files, loaderOptions } = instance; + const { compiler, languageService, files, loaderOptions, compilerOptions } = instance; + + let filePathRegex = !!compilerOptions.checkJs ? constants.dtsTsTsxJsJsxRegex : constants.dtsTsTsxRegex; + Object.keys(filesToCheckForErrors) - .filter(filePath => !!filePath.match(constants.dtsTsTsxRegex)) + .filter(filePath => !!filePath.match(filePathRegex)) .forEach(filePath => { const errors = languageService.getSyntacticDiagnostics(filePath).concat(languageService.getSemanticDiagnostics(filePath)); if (errors.length > 0) { diff --git a/src/constants.ts b/src/constants.ts index 0c35e89a9..79018d6ec 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -15,6 +15,7 @@ export const ModuleKindCommonJs = 1; export const tsTsxRegex = /\.ts(x?)$/i; export const dtsDtsxRegex = /\.d\.ts(x?)$/i; export const dtsTsTsxRegex = /(\.d)?\.ts(x?)$/i; +export const dtsTsTsxJsJsxRegex = /((\.d)?\.ts(x?)|js(x?))$/i; export const tsTsxJsJsxRegex = /\.tsx?$|\.jsx?$/i; export const jsJsx = /\.js(x?)$/i; export const jsJsxMap = /\.js(x?)\.map$/i; \ No newline at end of file