Navigation Menu

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 bf47cb5
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
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 bf47cb5

Please sign in to comment.