Polyfill Object.entries
Closed this issue ยท 8 comments
Hi! First thank you for this awesome module. It makes polyfilling much easier.
I want to polyfill Object.entries, using this npm package:
https://www.npmjs.com/package/object.entries
What's wrong with my code?
{
require: 'object.entries',
detect: () => 'entries' in window.Object,
install: entries => entries.shim(),
}
@mornir
Thank you.
Your code does look correct.
What error are you getting? Or what behaviour is not working for you?
In IE11, I still get the error Object doesn't support property or method 'entries'
๐ค
Can you try this and see if shimmed
is logged into the console of IE11?
{
require: 'object.entries',
detect: () => 'entries' in window.Object,
install: entries => {
entries.shim()
console.log('shimmed')
}
}
No, it's not logged. ๐
I don't know if this information is useful: the method 'entries' is used in this package https://www.npmjs.com/package/vue2-google-maps, which I import as a Nuxt plugin.
If I import the polyfill via polyfill.io, it works.
Can you post your Nuxt plugin here?
Here's the repo: https://github.com/mornir/sounding-soil
I made a pull request.
The polyfills are loaded subsequentially and only available in the default exported function of a plugin.
Awesome! It works! Thanks! ๐