Merge pull request #128 from vitaliytv/master

fix: add  type module support
This commit is contained in:
Todd Bluhm 2020-05-02 01:33:59 -05:00 committed by GitHub
commit e5163d7012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {