When using webpack and react babel compile the project, will be reported Preset files are not allowed to export objects error. Access to information, the main difference is not compatible with the use of versions of babel (version 6 and version 7 is not compatible).
Advanced versions (> 7) configuration so
package.json
"@babel/core": "^7.0.0-beta.40", "@babel/cli": "^7.0.0-beta.40", "babel-loader": "^8.0.0-beta.0", "babel-plugin-lodash": "^3.3.2", "babel-plugin-react-transform": "^3.0.0", "@babel/preset-react": "^7.0.0-beta.40",
.bablerc
query: { presets: ['@babel/react', '@babel/es2015'], plugins: ['@babel/proposal-class-properties'] }
There are loopholes in the low-level releases, npm audit does not recommend using low-level version, so here use the advanced version to build.
Reference links
https://blog.csdn.net/cyyy1223/article/details/78867941
https://segmentfault.com/a/1190000016783625
https://www.html.cn/archives/9427
The above described structures react + webpack + babel underlying processes
https://blog.csdn.net/weixin_36185028/article/details/81117730
Description packaged into a file, the entire configuration file, part of the file
https://www.cnblogs.com/tugenhua0707/p/9452471.html
Description of the role of different configuration and dependencies
https://www.e-learn.cn/index.php/content/wangluowenzhang/1121968
Advanced version of the configuration instructions