Dosn’t work with core-js@3

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?

2 thoughts on “Dosn’t work with core-js@3

  1. 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
    • Page runs fine
    • If I inspect yarn.lock or node_modules/ I see core-js ~2.6 installed
    • yarn upgrade core-js@latest (upgrade core js to 3)
    • cd nuxt-test
    • yarn dev
    • I see errors like the one you reported.

    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.

  2. 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:

    • Ran yarn add -D core-js@3 @babel/runtime-corejs3
    • Added the babel nuxt.config.js, as per the above link

    I’m not explicitly adding core-js to my project. Looking at the yarn-lock file I’ve got 3.6.2 and core-js@^2.6.5 listed. For fun, confirmed everything worked when I did explictly add 3.6.x.

    Thank you @hsubox76