LoginSignup
1
1

More than 3 years have passed since last update.

nuxtでyarn add firebaseしたときにcore-jsがたくさんModule not foundするやつの対処法

Posted at

create-nuxt-appからNuxtアプリを作っていて、
yarn add firebaseをしたらこんなエラーがたくさん出てきたときの対処法

image.png

ここで解決案が出されていた

Module not found: Error: Can't resolve 'core-js/modules/es6.array.iterator' in '/app/.nuxt' · Issue #5287 · nuxt/nuxt.js

yarn add -D core-js@3 @babel/runtime-corejs3

からの、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 }
            }
          ]
        ]
      }
    }
  }
}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1