3
我正在使用react-router的代码拆分(动态路由)。当从webpack构建应用程序时,它不会给出错误,但是在运行它时,会给我错误require.ensure is not a function
。我也使用服务器端渲染。React Code拆分中的require.ensure错误
以下是我getComponent代码
module.exports = {
path: "/",
getComponent(nextState, cb) {
require.ensure([], (require) => {
cb(null, require('./component/Home'));
})
}
};