fix: fix safari 14 idb issue (#2053)
This commit is contained in:
parent
a166dccb59
commit
e0827be8c8
|
@ -88,6 +88,7 @@
|
||||||
"rollup-plugin-babel": "^4.4.0",
|
"rollup-plugin-babel": "^4.4.0",
|
||||||
"rollup-plugin-terser": "^7.0.2",
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"rtl-detect": "^1.0.3",
|
"rtl-detect": "^1.0.3",
|
||||||
|
"safari-14-idb-fix": "^1.0.2",
|
||||||
"sapper": "nolanlawson/sapper#for-pinafore-25",
|
"sapper": "nolanlawson/sapper#for-pinafore-25",
|
||||||
"sass": "^1.32.13",
|
"sass": "^1.32.13",
|
||||||
"stringz": "^2.1.0",
|
"stringz": "^2.1.0",
|
||||||
|
|
|
@ -6,10 +6,9 @@ import './routes/_utils/forceOnline'
|
||||||
import { mark, stop } from './routes/_utils/marks'
|
import { mark, stop } from './routes/_utils/marks'
|
||||||
import { loadPolyfills } from './routes/_utils/polyfills/loadPolyfills'
|
import { loadPolyfills } from './routes/_utils/polyfills/loadPolyfills'
|
||||||
import { loadNonCriticalPolyfills } from './routes/_utils/polyfills/loadNonCriticalPolyfills'
|
import { loadNonCriticalPolyfills } from './routes/_utils/polyfills/loadNonCriticalPolyfills'
|
||||||
|
import idbReady from 'safari-14-idb-fix'
|
||||||
|
|
||||||
mark('loadPolyfills')
|
Promise.all([idbReady(), loadPolyfills()]).then(() => {
|
||||||
loadPolyfills().then(() => {
|
|
||||||
stop('loadPolyfills')
|
|
||||||
mark('sapperStart')
|
mark('sapperStart')
|
||||||
sapper.start({ target: document.querySelector('#sapper') })
|
sapper.start({ target: document.querySelector('#sapper') })
|
||||||
stop('sapperStart')
|
stop('sapperStart')
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {
|
||||||
importIntlLocale, importIntlPluralRules, importIntlRelativeTimeFormat,
|
importIntlLocale, importIntlPluralRules, importIntlRelativeTimeFormat,
|
||||||
importRequestIdleCallback
|
importRequestIdleCallback
|
||||||
} from './asyncPolyfills'
|
} from './asyncPolyfills'
|
||||||
|
import { mark, stop } from '../marks'
|
||||||
|
|
||||||
async function loadIntlPolyfillsIfNecessary () {
|
async function loadIntlPolyfillsIfNecessary () {
|
||||||
// Have to chain these so that they load in the proper order.
|
// Have to chain these so that they load in the proper order.
|
||||||
|
@ -20,9 +21,11 @@ async function loadIntlPolyfillsIfNecessary () {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadPolyfills () {
|
export async function loadPolyfills () {
|
||||||
return Promise.all([
|
mark('loadPolyfills')
|
||||||
|
await Promise.all([
|
||||||
typeof requestIdleCallback !== 'function' && importRequestIdleCallback(),
|
typeof requestIdleCallback !== 'function' && importRequestIdleCallback(),
|
||||||
loadIntlPolyfillsIfNecessary()
|
loadIntlPolyfillsIfNecessary()
|
||||||
])
|
])
|
||||||
|
stop('loadPolyfills')
|
||||||
}
|
}
|
||||||
|
|
|
@ -5983,6 +5983,11 @@ rxjs@^6.6.7:
|
||||||
dependencies:
|
dependencies:
|
||||||
tslib "^1.9.0"
|
tslib "^1.9.0"
|
||||||
|
|
||||||
|
safari-14-idb-fix@^1.0.2:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/safari-14-idb-fix/-/safari-14-idb-fix-1.0.2.tgz#c489feca93bc71628019ff490487370255316b86"
|
||||||
|
integrity sha512-RvZsa8kntL5qOnLdJbHfF7oAw596M/mRjpHXpASGu1/Rpn4SnI2IemHz3oUeK0chngZIcwyBXLSYBLrpIeE42A==
|
||||||
|
|
||||||
safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
|
safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
|
||||||
version "5.1.2"
|
version "5.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
|
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
|
||||||
|
|
Loading…
Reference in a new issue