Package Exports
- lazyload-loader
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lazyload-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
lazyload-loader
按照路由分割的方式实现懒加载
用法:
npm install --save-dev lazyload-loaderwebpack配置
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: [
'babel-loader',
'lazyload-loader',
]
},
···
},
Router 的配置
// 使用lazy! 作为前缀
import Shop from 'lazy!./view/Shop';
// Route 正常使用
<Route path="/shop" component={Shop} />