nuxt: Missing core-js modules after upgrading to 2.9.1

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.

<div align="right">This bug report is available on Nuxt community (#c9663)</div>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20

Most upvoted comments

@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 }
            }
          ]
        ]
      }
    }
  }
}

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’m able to reproduce the error in nuxt 2.10.0 as well as nuxt-edge 2.10.0-26167690.0f8428fa