Nuxt.js: Nuxt + TypeScript + Firebase not building

Created on 22 Apr 2020  路  8Comments  路  Source: nuxt/nuxt.js

Version

v2.12.2

Reproduction link

https://github.com/Coooi/nuxt-typescript-firebase-issue

Steps to reproduce

Clone the sample project.
yarn install
yarn dev

You'll see that it's not building with the latest version of firebase.

What is expected ?

To build normally.

What is actually happening?

Many errors regarding core-js + babel + firebase.

bug-report

Most helpful comment

Can you try adding [email protected] to your (direct) dependencies or configuring { corejs: { version: 3 }} in the babel preset options?

Package managers such as npm or Yarn resolve to core-js@3 (dependency of Firebase JS SDK) without explicit installation. Since Nuxt.js (@nuxt/babel-preset-app) uses core-js@2 as a default value and package managers resolves core-js to core-js@3, you need to tell package managers to use [email protected] or configure Nuxt's babel preset to use core-js@3 as described in here.

@nuxt/babel-preset-app's README for more info.

All 8 comments

This issue doesn't sound related to TypeScript, it's cause of Firebase core-js polyfill :
image

@kevinmarrec Thanks for testing!
Indeed, should I report this to Firebase team?

@Coooi Yes, cause they seem to do weird things :)

@kevinmarrec
Here's their answer: https://github.com/firebase/firebase-js-sdk/issues/2968#issuecomment-617975070
I'll try to add Firebase modules separately to see if it works, but I think worth checking that issue with nuxt/@nuxt/babel-preset-app too.

Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

This one should be rechecked in my opinion.

Can you try adding [email protected] to your (direct) dependencies or configuring { corejs: { version: 3 }} in the babel preset options?

Package managers such as npm or Yarn resolve to core-js@3 (dependency of Firebase JS SDK) without explicit installation. Since Nuxt.js (@nuxt/babel-preset-app) uses core-js@2 as a default value and package managers resolves core-js to core-js@3, you need to tell package managers to use [email protected] or configure Nuxt's babel preset to use core-js@3 as described in here.

@nuxt/babel-preset-app's README for more info.

Starting [email protected], version of core-js detects automatically, And if you are using Nuxt < 2.14.0, you need to either install core-js@2 or use core-js@3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaredreich picture jaredreich  路  3Comments

mikekidder picture mikekidder  路  3Comments

mattdharmon picture mattdharmon  路  3Comments

uptownhr picture uptownhr  路  3Comments

pehbehbeh picture pehbehbeh  路  3Comments