Update to match log style for new env loading (#12137)

This commit is contained in:
JJ Kasper 2020-04-23 14:17:05 -05:00 committed by GitHub
parent 5d13e55a4a
commit 2ad351511e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'
import chalk from 'next/dist/compiled/chalk' import * as log from '../build/output/log'
import findUp from 'next/dist/compiled/find-up' import findUp from 'next/dist/compiled/find-up'
import dotenvExpand from 'next/dist/compiled/dotenv-expand' import dotenvExpand from 'next/dist/compiled/dotenv-expand'
import dotenv, { DotenvConfigOutput } from 'next/dist/compiled/dotenv' import dotenv, { DotenvConfigOutput } from 'next/dist/compiled/dotenv'
@ -88,16 +88,13 @@ export function loadEnvConfig(dir: string, dev?: boolean): Env | false {
result = dotenvExpand(result) result = dotenvExpand(result)
if (result.parsed) { if (result.parsed) {
console.log(`> ${chalk.cyan.bold('Info:')} Loaded env from ${envFile}`) log.info(`Loaded env from ${envFile}`)
} }
Object.assign(combinedEnv, result.parsed) Object.assign(combinedEnv, result.parsed)
} catch (err) { } catch (err) {
if (err.code !== 'ENOENT') { if (err.code !== 'ENOENT') {
console.error( log.error(`Failed to load env from ${envFile}`, err)
`> ${chalk.cyan.bold('Error: ')} Failed to load env from ${envFile}`,
err
)
} }
} }
} }