File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 11import { readFile } from 'node:fs/promises'
22import path from 'node:path'
33import process from 'node:process'
4- import { parseEnv } from 'node:util'
54import { blue } from 'ansis'
65import { createDefu } from 'defu'
76import isInCi from 'is-in-ci'
@@ -33,6 +32,7 @@ import type {
3332} from './types.ts'
3433
3534const debug = createDebug ( 'tsdown:config:options' )
35+ const parseEnv = process . getBuiltinModule ( 'node:util' ) . parseEnv
3636
3737/**
3838 * Resolve user config into resolved configs
@@ -187,6 +187,11 @@ export async function resolveUserConfig(
187187 }
188188 const envFromProcess = filterEnv ( process . env , envPrefix )
189189 if ( envFile ) {
190+ if ( ! parseEnv ) {
191+ throw new Error (
192+ `Your runtime does not support 'util.parseEnv()'. Please upgrade to Node.js v20.12.0 or later.` ,
193+ )
194+ }
190195 const resolvedPath = path . resolve ( cwd , envFile )
191196 logger . info ( nameLabel , `env file: ${ color ( resolvedPath ) } ` )
192197
You can’t perform that action at this time.
0 commit comments