polyfill-io-loader
polyfill-io-loader copied to clipboard
Cannot use 'in' operator to search for 'Promise' in undefined
Tracelog:
at Module../node_modules/polyfill-io-loader/index.js!./?Promise ((index):2)
at __webpack_require__ (bootstrap:63)
at Module.<anonymous> (common.js:1)
at Module../app/javascript/common.js (common.js:39)
at __webpack_require__ (bootstrap:63)
at Module.<anonymous> (theexplorista.js:12)
at Module../app/javascript/packs/theexplorista.js (theexplorista.js:14)
at __webpack_require__ (bootstrap:63)
at Object.10 (log.js:59)
at __webpack_require__ (bootstrap:63)
Usage:
import loadPolyfills from 'polyfill-io-loader!?Promise,NodeList.prototype.forEach,Object.assign';
window.onload = () => {
loadPolyfills(() => {
document.querySelectorAll('.vue').forEach((el) => {
// eslint-disable-next-line no-new
new Vue({ el });
});
});
};```
I managed to fix the issue, by changing this line to folowwing code
https://github.com/garygreen/polyfill-io-loader/blob/master/index.js#L31
return '[' + JSON.stringify(o[0]) + ',' + o[1].replace('this', 'window') + ']';