我正确地遵循了完整的教程,网址为
https://blog.cloudboost.io/learn-how-to-create-a-simple-blog-with-react-node-c05fa6889de3
但是当我在客户端运行npm start
时,出现以下错误:
ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/apple/Desktop/leoBlog/client/node_modules/babel-preset-react/lib/index.js
at createDescriptor (/Users/apple/Desktop/leoBlog/client/node_modules/@babel/core/lib/config/config-descriptors.js:178:11)
at items.map (/Users/apple/Desktop/leoBlog/client/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (/Users/apple/Desktop/leoBlog/client/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/Users/apple/Desktop/leoBlog/client/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
at presets (/Users/apple/Desktop/leoBlog/client/node_modules/@babel/core/lib/config/config-descriptors.js:47:19)
at mergeChainOpts (/Users/apple/Desktop/leoBlog/client/node_modules/@babel/core/lib/config/config-chain.js:320:26)
at /Users/apple/Desktop/leoBlog/client/node_modules/@babel/core/lib/config/config-chain.js:283:7
at buildRootChain (/Users/apple/Desktop/leoBlog/client/node_modules/@babel/core/lib/config/config-chain.js:120:22)
at loadPrivatePartialConfig (/Users/apple/Desktop/leoBlog/client/node_modules/@babel/core/lib/config/partial.js:85:55)
@ multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/index.js main[2]
由于我在Webpack上是新手,所以我试图将babel更新到7.1.5,所以不确定webpack.config.js
上可以进行哪些更改。