Skip to content

Commit

Permalink
fix: add type module support
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaTv committed Apr 15, 2020
1 parent e66cfc1 commit 8d94925
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/parse-env-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/parse-rc-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/parse-env-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/parse-rc-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8d94925

Please sign in to comment.