Vue reports an error when babel-preset-es2015 starts a project when adding an on-demand load to the UI library

The

project uses the vue cli3 scaffolding tool to build
as shown in the element official documentation.
npm install babel-plugin-component-D
then add the .babelrc file
{
"presets": [

["es2015", {
  "modules": false
}]

],
"plugins": [

[
  "component",
  {
    "libraryName": "element-ui",
    "styleLibraryName": "theme-chalk"
  }
]

]
}
the startup project found that babel-preset-es2015 was missing, so cnpm install-- save babel-preset-es2015 installed
and then the startup project reported an error
Error: Plugin/Preset files are not allowed to export objects, only functions.. In E:vue3-confignode_modulesbabel-preset-es2015libindex.js
novice Xiaobai asks for online solutions


1. Install the @ babel/preset-env; project directory and run the command line

npm i @babel/preset-env -D

2. Modify the .babelrc file to change es2015 to @ babel/preset-env

{
  "presets": [["@babel/preset-env", { "modules": false }]],
  "plugins": [
    [
      "component",
      {
        "libraryName": "element-ui",
        "styleLibraryName": "theme-chalk"
      }
    ]
  ]
}

3. Rerun project
in fact, the configuration items of .babelrc can be written to the babel.config.js file, and the .babelrc file is no longer needed after that


it is recommended not to use cnpm to try again, delete all node_module and use npm to try again

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b782-2c2c4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b782-2c2c4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?