I'm using this great starter kit, and during development, everything works fine from Chrome and Firefox. Unfortunately, when I try to test my app using Safari, I get the error
TypeError: Object.entries is not a function. (In 'Object.entries(o)', 'Object.entries' is undefined)
Is something going wrong with the Babel transpile? This issue also occurs when I create a production build and serve it.
Are you using a generator or Object.entries anywhere? Presumably it could be something else, but you may want to try including https://www.npmjs.com/package/babel-polyfill (see https://babeljs.io/docs/usage/polyfill/) to polyfill missing ES6 features in browsers. You could insert this at the top of ~/src/main.js or in the configured vendor modules.
My _guess_ is that this is something specific to your application. If it is something that you can reproduce from a fresh clone I can look into a fix, but this may just be a matter of including the necessary polyfills for your targeted browsers.
Hope that helps.
I am using Object.entries explicitly in a few places, which is not present in a fresh clone. Does running npm start or npm run build not transpile the code into es5 when it minifies? Thanks for the help!
It does transpile code, but there's a distinction (and this is something about babel as a whole, not this project in particular): it transpiles _syntax_, not language features. So it will take arrrow functions, classes, etc. and convert them to ES5-supported syntax, but it will not polyfill language features such as promises, Object.entries, Map, etc. This is what babel-polyfill is for, to shim in missing language features.
Gotcha. I added babel-polyfill via npm and import 'babel-polyfill'
in the app entry point, and everything cleared up. Thanks for clearing that up for me!
Most helpful comment
Gotcha. I added
babel-polyfillvia npm andimport 'babel-polyfill'in the app entry point, and everything cleared up. Thanks for clearing that up for me!