mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(kit): dotenv esm compactiblity (#799)
Co-authored-by: pooya parsa <pyapar@gmail.com>
This commit is contained in:
parent
926062db3d
commit
6e52775bf9
@ -1,6 +1,6 @@
|
|||||||
import { existsSync, promises as fsp } from 'fs'
|
import { existsSync, promises as fsp } from 'fs'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { parse as parseDotEnv } from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
import { LoadNuxtConfigOptions } from './load'
|
import { LoadNuxtConfigOptions } from './load'
|
||||||
|
|
||||||
export interface LoadDotEnvOptions {
|
export interface LoadDotEnvOptions {
|
||||||
@ -62,7 +62,7 @@ export async function loadDotenv (opts: LoadDotEnvOptions) {
|
|||||||
const dotenvFile = resolve(opts.rootDir, opts.dotenvFile)
|
const dotenvFile = resolve(opts.rootDir, opts.dotenvFile)
|
||||||
|
|
||||||
if (existsSync(dotenvFile)) {
|
if (existsSync(dotenvFile)) {
|
||||||
const parsed = parseDotEnv(await fsp.readFile(dotenvFile, 'utf-8'))
|
const parsed = dotenv.parse(await fsp.readFile(dotenvFile, 'utf-8'))
|
||||||
Object.assign(env, parsed)
|
Object.assign(env, parsed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user