添加babel插件
1. 安装插件
npm install -i babel-plugin-syntax-dynamic-import
2.在.babelrc
"plugins": [
"syntax-dynamic-import"
],
3.router文件index.js中
const home = () => import("@/pages/public/home");
{
path: "home",
component: home
},