Elememt UI introduces components on demand to report errors

Background: the project based on vue-cli3 introduces error reporting on demand

According to the official documents, introduce components as required, as follows:
1. Install: NPM install Babel plugin component – d
2 babel.config.js Modify configuration in

module.exports = {
  presets: [["es2015", { modules: false }]],
  plugins: [
    [
      "component",
      {
        libraryName: "element-ui",
        styleLibraryName: "theme-chalk",
      },
    ],
  ],
};

3. After running, Babel compiles and reports an error:
cannot find module ‘babel-preset-es2015’
4. Query the document and find the following sentence:
this preset is not recommended. If you want to keep it up to date, please use env preset
5. Solution:
1) install NPM install — save dev @ Babel/preset env
2) modify babel.config.js “Es2015” is “@ Babel/preset env”
3)

Official website link reference: https://babel.docschina.org/docs/en/6.26.3/babel-preset-es2015/


Read More: