Closed chemoish closed 9 years ago
Maybe someone from the future will needs this. So here we are.
Not exactly sure if this is optimal, but it seems to be working.
Define multiple entry points.
entry: {
app: './src/app.js',
pageHome: './src/components/home/Home.js',
pageSetting: './src/components/setting/Setting.js'
}
Define the common chunk plugin to look at your end points.
plugins: [
new webpack.optimize.CommonsChunkPlugin('common.js', [
'app',
'pageHome',
'pageSetting'
], 2)
]
Utilize react-router
and react-router-proxy-loader
… (Not sure if this works with bundle-loader
alone).
https://github.com/rackt/react-router/blob/0.13.x/docs/guides/overview.md https://github.com/odysseyscience/react-router-proxy-loader
<Route path="/" handler={App}>
<DefaultRoute handler={require('react-router-proxy!./components/home/Home.js')}></DefaultRoute>
<Route name="home" handler={require('react-router-proxy!./components/home/Home.js')}></Route>
<Route name="setting" path="settings" handler={require('react-router-proxy!./components/setting/Setting.js')}></Route>
</Route>
common.js
.react-hot
, babel-loader
, file-loader
, style-loader
, etc.
It does not seem like a bundle can be loaded lazily or otherwise (So I am not sure how you would load Profile/Feed).
How does one achieve loading multiple entry points over some router?