Vue项目构建开发笔记(vue-lic3.0构建的)

1、router.js里面

{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
}
webpackChunkName

注释的webpackChunkName就类似于起了一个别名

Vue项目构建开发笔记(vue-lic3.0构建的)

参考地址:

https://router.vuejs.org/zh/guide/advanced/lazy-loading.html

把组件按组分块 (webpackChunkName的妙用)

有时候我们想把某个路由下的所有组件都打包在同个异步块 (chunk) 中。只需要使用 命名 chunk,一个特殊的注释语法来提供 chunk name (需要 Webpack > 2.4)。

const Foo = () => import(/* webpackChunkName: "group-foo" */ './Foo.vue')
const Bar = () => import(/* webpackChunkName: "group-foo" */ './Bar.vue')
const Baz = () => import(/* webpackChunkName: "group-foo" */ './Baz.vue')

https://webpack.js.org/guides/code-splitting/

上一篇:Django之Cookie和Session


下一篇:快速构建Windows 8风格应用8-贴靠视图