I face warning about babel when create-nuxt-app, I don’t know babel..

Base

my package.json

   ╭───────────────────────────────────────╮
   │                                       │
   │   Nuxt @ v2.15.4                      │
   │                                       │
   │   ▸ Environment: development          │
   │   ▸ Rendering:   client-side          │
   │   ▸ Target:      static               │
   │                                       │
   │   Listening: http://localhost:3000/   │
   │                                       │
   ╰───────────────────────────────────────╯

Warning

 WARN  Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.                                              16:10:06
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
	["@babel/plugin-proposal-private-methods", { "loose": true }]
to the "plugins" section of your Babel config.

Fix

  • 1) installing library

    yarn add -D  @babel/plugin-proposal-private-methods
    
  • 2) Add config to nuxt.config.js to build

    build: {
    babel: {
      "plugins": [["@babel/plugin-proposal-private-methods", { "loose": true }]]
    }
    }
    

Ref

babeljs.io/docs
Odd ‘loose’ mode configuration must be the same…