Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Use Firebase Polyfills in Vanilla JS

I'm currently building a vanilla webpage that uses Google Firebase to handle both Authentication and data storage, using the Firebase Realtime Database. This is how I am including Firebase, at the bottom of my HTML file:

<script src="https://www.gstatic.com/firebasejs/6.4.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.4.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.4.1/firebase-database.js"></script>

This all works fine and dandy in most browsers. However, in Internet Explorer, it throws various errors about not having certain es6 functions, most frequently Array.findIndex and Object.values.

The Firebase supported environments page says that polyfills are required -- fair enough. However, I'm unclear how to include the recommended "ES Stable" into a vanilla html/js page, as all their examples involve bundlers or frameworks.

I'm looking for an example or explanation of how to include this, or any polyfill that solves the problem, into a regular HTML/JS page.

like image 526
Declan McKelvey-Hembree Avatar asked Oct 25 '25 12:10

Declan McKelvey-Hembree


1 Answers

After looking over the core-js installation section, it looks like they do provide a CDN that you could attach. The exact text is this:

Already bundled version of core-js on CDN (minified version).

The CDN they are referring to is here, and the minified version is here.

like image 168
entersudonym Avatar answered Oct 27 '25 01:10

entersudonym



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!