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
#2515)

Closes #2513
  • Loading branch information
ahnpnl authored Apr 14, 2021
1 parent f3522d8 commit 0320fb3
Show file tree
Hide file tree
Showing 3 changed files with 13 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.

9 changes: 7 additions & 2 deletions src/compiler/language-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,14 @@ 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 }))
const message = interpolate(Errors.CannotProcessFile, { file: fileName })
if (TS_TSX_REGEX.test(fileName)) {
throw new Error(message)
} else {
logger.warn(message)

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

0 comments on commit 0320fb3

Please sign in to comment.