Skip to content
2 changes: 1 addition & 1 deletion packages/vite/rolldown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const moduleRunnerConfig = defineConfig({
'@vitejs/devtools/cli-commands',
...Object.keys(pkg.dependencies),
],
plugins: [bundleSizeLimit(54), enableSourceMapsInWatchModePlugin()],
plugins: [bundleSizeLimit(55), enableSourceMapsInWatchModePlugin()],
output: {
...sharedNodeOptions.output,
minify: {
Expand Down
14 changes: 10 additions & 4 deletions packages/vite/src/module-runner/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
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')
const textDecoder = new TextDecoder()
Comment thread
WhiteKiwi marked this conversation as resolved.

export const decodeBase64: (base64: string) => string = (() => {
if (typeof Buffer === 'function' && typeof Buffer.from === 'function') {
return (base64: string) => Buffer.from(base64, 'base64').toString('utf-8')
}

return (base64: string) =>
textDecoder.decode(Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)))
})()

const CHAR_FORWARD_SLASH = 47
const CHAR_BACKWARD_SLASH = 92
Expand Down
Loading