Skip to content
8 changes: 4 additions & 4 deletions packages/vite/src/module-runner/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as pathe from 'pathe'
import { isWindows } from '../shared/utils'

export const decodeBase64: typeof atob =
typeof atob !== 'undefined'
? atob
: (str: string) => Buffer.from(str, 'base64').toString('utf-8')
export const decodeBase64: (base64: string) => string =
typeof Buffer === 'function' && typeof Buffer.from === 'function'
? (str: string) => Buffer.from(str, 'base64').toString('utf-8')
: atob

const CHAR_FORWARD_SLASH = 47
const CHAR_BACKWARD_SLASH = 92
Expand Down