fix: add type module support

This commit is contained in:
ElenaTv 2020-04-15 07:41:02 +03:00
parent e66cfc10f1
commit 8d94925a44
4 changed files with 4 additions and 4 deletions

View File

@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const path = require("path");
const utils_1 = require("./utils");
const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js'];
const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js', '.cjs'];
/**
* Gets the environment vars from an env file
*/

View File

@ -23,7 +23,7 @@ async function getRCFileVars({ environments, filePath }) {
const ext = path_1.extname(absolutePath).toLowerCase();
let parsedData;
try {
if (ext === '.json' || ext === '.js') {
if (ext === '.json' || ext === '.js' || ext === '.cjs') {
const possiblePromise = require(absolutePath); /* eslint-disable-line */
parsedData = utils_1.isPromise(possiblePromise) ? await possiblePromise : possiblePromise;
}

View File

@ -2,7 +2,7 @@ import * as fs from 'fs'
import * as path from 'path'
import { resolveEnvFilePath, isPromise } from './utils'
const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js']
const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js', '.cjs']
/**
* Gets the environment vars from an env file

View File

@ -26,7 +26,7 @@ export async function getRCFileVars (
const ext = extname(absolutePath).toLowerCase()
let parsedData: { [key: string]: any }
try {
if (ext === '.json' || ext === '.js') {
if (ext === '.json' || ext === '.js' || ext === '.cjs') {
const possiblePromise = require(absolutePath) /* eslint-disable-line */
parsedData = isPromise(possiblePromise) ? await possiblePromise : possiblePromise
} else {