## chunkFilename
`chunkFilename`是除了`entry`定义的入口`js`之外的`js`~
~~~
output: {
path: path.join(__dirname, './dist'),
filename: 'bundle.js',
chunkFilename: '[name].js'
}
~~~
现在你运行发现名字变成`home.js`,这样的了。棒棒哒!
那么问题来了`home`是在哪里设置的?`webpack`怎么知道他叫`home`?
其实在这里我们定义了,`router.js`里面:
~~~
// 看到没。这里有个name=home。嘿嘿。
import Home from 'bundle-loader?lazy&name=home!pages/Home/Home'
~~~
参考地址:
1. http://www.jianshu.com/p/8dd98a7028e0
2. https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/code-splitting.md
3. https://segmentfault.com/a/1190000007949841
4. http://react-china.org/t/webpack-react-router/10123
5. https://juejin.im/post/58f9717e44d9040069d06cd6