How to use Firebase Version 9 Compatibility from CDN?

Viewed 462

Since version 9, Firebase introduced a new Module based API. This however requires changes in your code if you upgrade from earlier versions to 9.

At the same time version 9 has a compatibility version that is based on earlier API. The instruction tells you how to use it as npm module https://firebase.google.com/docs/web/modular-upgrade

But it doesn't tell how to upgrade to version 9 compatibility version if you are loading firebase from CDN.

My understanding is that to upgrade to version 9 without changing my code I need to simply update the version part of the URL and add a '-compat' before '.js' extension.

e.g. from version 8.10.0 to 9.3.0 I changed my links from

https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js

to

https://www.gstatic.com/firebasejs/9.3.0/firebase-app-compat.js

same thing for firestore and auth e.g.

http://www.gstatic.com/firebasejs/9.3.0/firebase-firestore-compat.js
http://www.gstatic.com/firebasejs/9.3.0/firebase-auth-compat.js

Everything is working, however I didn't find any docs to confirm this. if you know of any docs for using version 9 compatibility from CDN please reply.

0 Answers
Related