Latest installation of nuxt uses core-js@3 where all references to es6 and es7 were consolidated into es.
Nuxt breaks after installing firebase npm package with errors like:
core-js/modules/es6.array.find in ./.nuxt/client.js
It is looking for es6 instead of es.
Downgrading core-js to version 2 is not an option for me.
Is there any other solution?
I don’t think this is a Firebase issue. I followed these steps without Firebase being involved:
yarn create nuxt-app nuxt-test
cd nuxt-test
yarn dev
yarn.lock
ornode_modules/
I see core-js ~2.6 installedyarn upgrade core-js@latest
(upgrade core js to 3)cd nuxt-test
yarn dev
The Nuxt default app doesn’t seem to automatically come with core-js 3 as far as I can tell, it comes with 2? In order to add core-js 3, these seem to be the steps: https://nuxtjs.org/guide/release-notes#v2.6.0 . After I followed those steps, I didn’t see the errors.
I installed firebase as well and didn’t see any additional errors, but I wasn’t able to include your
firebase.js
file in the running Nuxt app since I don’t really know Vue or where to put JS files in this structure.I had the same problem as the OP and explicitly downgraded to core-js 2.6.10. That got everything working but was always curious why it was a problem as older projects didn’t have that issue.
The instructions in the nuxt js release notes worked! No more errors for me. https://nuxtjs.org/guide/release-notes#v2.6.0
As per the docs:
yarn add -D core-js@3 @babel/runtime-corejs3
I’m not explicitly adding core-js to my project. Looking at the yarn-lock file I’ve got
3.6.2
andcore-js@^2.6.5
listed. For fun, confirmed everything worked when I did explictly add 3.6.x.Thank you @hsubox76