Nuxt.js: Missing core-js modules after upgrading to 2.9.1

Created on 20 Aug 2019  路  20Comments  路  Source: nuxt/nuxt.js

Version

v2.9.1

Reproduction link

https://github.com/command-tab/nuxt291bug

Steps to reproduce

Upgrade from Nuxt 2.8.1 to Nuxt 2.9.1, npm i, then run npm run dev

What is expected ?

A successful Nuxt build and dev server startup

What is actually happening?

Errors reporting that a bunch of core-js modules are missing. See the README.md in the Reproduction Link for the full error list: https://github.com/command-tab/nuxt291bug/blob/master/README.md

Additional comments?

I have run rm -rf .nuxt node_modules package-lock.json and re-run npm i && npm run dev in my actual project and observed no improvement. As well, I've extracted minimal test app which also exhibits the issue.

This bug report is available on Nuxt community (#c9663)
bug-report question stale

Most helpful comment

@remychvn can you paste the code needed here? The link you posted is not working.

Yes absolutely ! 馃槂

nuxt.config.js

  export default {
  build: {
    babel: {
      presets({ isServer }) {
        return [
          [
            require.resolve('@nuxt/babel-preset-app'),
            // require.resolve('@nuxt/babel-preset-app-edge'), // For nuxt-edge users
            {
              buildTarget: isServer ? 'server' : 'client',
              corejs: { version: 3 }
            }
          ]
        ]
      }
    }
  }
}

All 20 comments

Cannot reproduce this when using yarn instead of npm, but I can with npm.

Manually installing the corejs runtime resolves the issue: npm i -D core-js@2 @babel/runtime-corejs2. Its a bit hidden but this is described in the release notes of v2.6.0

I've been using npm exclusively because it's slightly more convenient for my particular production deployment setup. Do you think it's worth switching to yarn to avoid dependency issues like this? Do Nuxt developers generally recommend yarn over npm?

You should use the tool that works best for you, while keeping in mind another exists for when issues like this occurs. Both npm and yarn are good options but both sometimes fail. That said, in my personal experience it seems that stuff like this issue happens a bit less with yarn then with npm.

I am not gonna tell you which one to use, but if you look through the Nuxt eco-system on Github you will probably see yarn.lock more often then package-lock.json ;)

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.

Not stale, just awaiting a possible fix 馃槣

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.

I'm able to reproduce the error in nuxt 2.10.0 as well as nuxt-edge 2.10.0-26167690.0f8428fa

To fix this error I had to install core-js 2 manually.
Otherwise version 3.X.X is installed by npm automatically, which causes build errors.

npm install core-js@2 --save-dev

_Nuxt 2.10.0_

Is there a roadmap for corejs 3.x support?

Yeah I still needed to install core-js@2 manually on 2.10.2 to get things working properly.

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.

I'm still able to reproduce the error in nuxt 2.10.2 as well as [email protected]

Is there a roadmap for corejs 3.x support?

Core JS 3 is already supported but you need to change your nuxt.config.js according to the releases notes:
https://fr.nuxtjs.org/guide/release-notes/#-code-core-js-3-code-

These will be soon the default settings: https://github.com/nuxt/nuxt.js/pull/6721

@remychvn can you paste the code needed here? The link you posted is not working.

@remychvn can you paste the code needed here? The link you posted is not working.

Yes absolutely ! 馃槂

nuxt.config.js

  export default {
  build: {
    babel: {
      presets({ isServer }) {
        return [
          [
            require.resolve('@nuxt/babel-preset-app'),
            // require.resolve('@nuxt/babel-preset-app-edge'), // For nuxt-edge users
            {
              buildTarget: isServer ? 'server' : 'client',
              corejs: { version: 3 }
            }
          ]
        ]
      }
    }
  }
}

The link doesn't work because it doesn't expand the version notes - look at here under Core-js https://nuxtjs.org/guide/release-notes#v2.6.0

Also, worth noting for someone like me trying to use Promise.allSettled with nuxt, you can add proposals by tweaking the above config to corejs: { version: 3, proposals: true }

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.

Still an issue with 2.11.0 release version 馃槥

FYI, pnpm works with the fix at https://nuxtjs.org/guide/release-notes#v2.6.0. Just curious why those dependencies are not declared by Nuxt.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lazycrazy picture lazycrazy  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments

mikekidder picture mikekidder  路  3Comments

mattdharmon picture mattdharmon  路  3Comments

gary149 picture gary149  路  3Comments