element-ui按需引入的坑-- Using removed Babel 5 option: .modules - Use the corresponding module transform plugin in the plugins option.
首先参照官网组件 | Element
这里的presets:要改成 presets: [ ["@vue/cli-plugin-babel/preset"], ["@babel/preset-env", { modules: false }], ],
另外还要注意,在这之前还要执行命令 npm i @babel/preset-env -D
否则会出现报错:
Using removed Babel 5 option: .modules - Use the corresponding module transform plugin in the plugins option.
就这些,避雷吧!