0
嘗試使用反應路由器實現代碼分割。反應路由器getIndexRoute不會呈現
index.jsx
const routes = {
path: '/',
component: App,
getIndexRoute(partialNextState, callback) {
require.ensure([], function (require) {
callback(null, {
component: require('./home/index.jsx'),
})
})
},
childRoutes: []
}
家/ index.jsx
module.exports = {
getComponent(nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./components/home.jsx'))
})
}
}
家/組件/ home.jsx包含
module.exports = Home
沒有編譯或渲染錯誤。這個怎麼用?使用的WebPack 1.13和反應路由器2.5