Skip to content

Commit e83603a

Browse files
authored
Fix Vite support (#92)
Allows colorette to work both in Node and in the browser as an ESM module.
1 parent 106748e commit e83603a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import * as tty from "tty"
22

3-
const env = process.env || {}
4-
const argv = process.argv || []
3+
const proc = typeof process === "undefined" ? {} : process
4+
5+
const env = proc.env || {}
6+
const argv = proc.argv || []
57

68
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color")
79
const isForced = "FORCE_COLOR" in env || argv.includes("--color")
8-
const isWindows = process.platform === "win32"
10+
const isWindows = proc.platform === "win32"
911
const isDumbTerminal = env.TERM === "dumb"
1012

1113
const isCompatibleTerminal =

0 commit comments

Comments
 (0)