fix(pdf): polyfill URL.parse for Chrome <129 compatibility

This commit is contained in:
Woody 2026-04-28 13:11:54 +08:00
parent 49eed1f27e
commit fdd5a09c28
1 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,11 @@
// Polyfill URL.parse for browsers that don't support it (Chrome <129, Firefox <135, Safari <18.2)
// Required by pdfjs-dist 5.x which uses this API in production builds
if (!('parse' in URL)) {
;(URL as any).parse = (url: string, base?: string) => {
try { return new URL(url, base) } catch { return null }
}
}
import React from 'react' import React from 'react'
import { createRoot } from 'react-dom/client' import { createRoot } from 'react-dom/client'
import App from './App' import App from './App'