vue路由懒加载
2019-04-11 本文已影响0人
unspecx
require amd
const Hello = resolve => require(["@/views/Hello"], resolve);
Webpack 2 使用动态 import
const Welcome = () => import('@/views/Welcome');
组件按组分块
Webpack > 2.4借助不同的特殊的注释语法可以把多个组件打包到一个异步块(chunk)中,
用assigned-group-chunk-name
指定的异步块名。
const Welcome = () => import(/* webpackChunkName: "assigned-group-chunk-name" /'@/views/Welcome');
const Hello = () => import(/ webpackChunkName: "assigned-group-chunk-name" */'@/views/Hello');