vue 路由懒加载

添加babel插件

packjson.json

"babel-plugin-syntax-dynamic-import": "6.18.0",

.babelrc

    "plugins": [
        "syntax-dynamic-import"
    ],

 

 

webpack 配置

webpack.base.conf.js

output: {
        chunkFilename: "chunk[id].js?[chunkhash]"
    },

 

router

index.js

const home = () => import("@/pages/public/home");

{
    path: "home",
    component: home
 },

 

posted @ 2018-11-05 14:03  陈小银  阅读(361)  评论(0编辑  收藏  举报