近来想要自己搭建react环境进行学习,现在react版本为react16.x,使用的babel是6.x版本的,然后后面路由分包需要分包加载,react-router4版本使用官方提供的@babel/plugin-syntax-dynamic-import + loadable-components ,地址https://reacttraining.com/react-router/web/guides/code-splitting。低于react-router低于4.x用官方文档旧方法http://react-guide.github.io/react-router-cn/docs/guides/advanced/DynamicRouting.html,自行找其他文章吧。。。
但是马上包就冲突不匹配了,于是需要将babel提升至7.x版本,一系列的preset和plugin包也需要修改
babel7.x包名为@babel/*, @babel/preset-8, @babel/plugin-*;
版本汇总:
webpack: 4.x
react: 16.x
react-router: 4.x
react-router-dom: 3.x => 4.x
babel: 6.x => 7.x
loadable/component: 5.x
1、re