react-router4.0 && bundle-loader 按需加载方案简化工具
npm install --save bundle-loader-easy
let lazyload = require('bundle-loader-easy');
let components = lazyload(array);
##引入
let lazyload = require('bundle-loader-easy')
##懒加载数组
array = [{
name: 'A',
component: require('bundle-loader?lazy!./containers/')
}]
or
array = {
name: 'A',
component: require('bundle-loader?lazy!./containers/')
}
##载入
let components = lazyload(array)
##router设置
<Route path="/A" component={components.A}/>