Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: hide debug warning if typescript is not found
Browse files Browse the repository at this point in the history
Fixes #73
  • Loading branch information
jdx committed Feb 19, 2019
1 parent 4607c80 commit feae7b2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ts-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ import * as TSNode from 'ts-node'
import Debug from './debug'
const debug = Debug()

let typescript: typeof import('typescript')
try {
typescript = require('typescript')
} catch (ex) {
debug('Cannot find typescript', ex)
}

const tsconfigs: {[root: string]: TSConfig} = {}
const rootDirs: string[] = []
const typeRoots = [`${__dirname}/../node_modules/@types`]
Expand Down Expand Up @@ -65,6 +58,13 @@ function registerTSNode(root: string) {

function loadTSConfig(root: string): TSConfig | undefined {
const tsconfigPath = path.join(root, 'tsconfig.json')
let typescript: typeof import('typescript') | undefined
try {
typescript = require('typescript')
} catch {
// debug('Cannot find typescript', ex)
}

if (fs.existsSync(tsconfigPath) && typescript) {
const tsconfig = typescript.parseConfigFileTextToJson(
tsconfigPath,
Expand Down

0 comments on commit feae7b2

Please sign in to comment.