Skip to content

Commit

Permalink
fix(compiler): return file content on emitSkipped for non ts/tsx files
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl committed Apr 14, 2021
1 parent f3522d8 commit 7887cec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions e2e/__templates__/with-babel-7/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/compiler/language-service.ts
Expand Up @@ -260,9 +260,13 @@ export const initializeLanguageServiceInstance = (configs: ConfigSet, logger: Lo
}
/* istanbul ignore next (this should never happen but is kept for security) */
if (output.emitSkipped) {
logger.warn(interpolate(Errors.CannotProcessFile, { file: fileName }))
if (TS_TSX_REGEX.test(fileName)) {
throw new Error(interpolate(Errors.CannotProcessFile, { file: fileName }))
} else {
logger.warn(interpolate(Errors.CannotProcessFile, { file: fileName }))

return [code, '{}']
return [code, '{}']
}
}
// Throw an error when requiring `.d.ts` files.
if (!output.outputFiles.length) {
Expand Down

0 comments on commit 7887cec

Please sign in to comment.