diff --git a/lib/config.js b/lib/config.js index b08bbde7d..30e874ee6 100644 --- a/lib/config.js +++ b/lib/config.js @@ -27,7 +27,7 @@ try { } catch (e) {} try { - require('ts-node').register() + require('ts-node') TYPE_SCRIPT_AVAILABLE = true } catch (e) {} @@ -374,6 +374,9 @@ function parseConfig (configFilePath, cliOptions, parseOptions) { let configModule if (configFilePath) { try { + if (path.extname(configFilePath) === '.ts' && TYPE_SCRIPT_AVAILABLE) { + require('ts-node').register() + } configModule = require(configFilePath) if (typeof configModule === 'object' && typeof configModule.default !== 'undefined') { configModule = configModule.default