add URLSearchParams polyfill
This commit is contained in:
parent
bd6e2827c9
commit
a249b2a608
|
@ -5011,6 +5011,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"url-search-params": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/url-search-params/-/url-search-params-0.10.0.tgz",
|
||||
"integrity": "sha512-oFPzmbPAbdthStgffGq8alULe47skPDt1X3KW6NOQnKkcLHP4IS1NfdfHG/CBP5lGsr2gDzNp87pfWLx/eIxjw=="
|
||||
},
|
||||
"util": {
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
"svelte": "^1.50.0",
|
||||
"svelte-loader": "^2.3.3",
|
||||
"uglifyjs-webpack-plugin": "^1.1.5",
|
||||
"url-search-params": "^0.10.0",
|
||||
"webpack": "^3.10.0"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -1,4 +1,17 @@
|
|||
import { init } from 'sapper/runtime.js';
|
||||
|
||||
// `routes` is an array of route objects injected by Sapper
|
||||
init(document.querySelector('#sapper'), __routes__);
|
||||
// polyfills
|
||||
Promise.all([
|
||||
typeof URLSearchParams === 'undefined' && import('url-search-params').then(Params => {
|
||||
window.URLSearchParams = Params
|
||||
Object.defineProperty(window.URL.prototype, 'searchParams', {
|
||||
get() {
|
||||
return new Params(this.search)
|
||||
}
|
||||
})
|
||||
})
|
||||
]).then(() => {
|
||||
console.log('done')
|
||||
// `routes` is an array of route objects injected by Sapper
|
||||
init(document.querySelector('#sapper'), __routes__)
|
||||
})
|
Loading…
Reference in New Issue