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');
网友评论