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

fix: hide debug warning if typescript is not found #75

Merged
merged 1 commit into from
Feb 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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