认证0级讲师
Look to see if there is a .babelrc file. Have you forgotten this file?
In addition, the .babelrc file must have a react plugin.
Firstnpm install babel-plugin-import babel-plugin-react-transform --save-p
npm install babel-plugin-import babel-plugin-react-transform --save-p
Then .babelrc must have at least these: ("stage-0" optional)
{ "presets": ["react", "es2015", "stage-0"] //... 其他东西 }
In fact, you can also install more, such as adding these to devDependencies in package.json
"babel-core": "^6.24.0", "babel-loader": "^6.4.1", "babel-plugin-import": "^1.1.1", "babel-plugin-react-transform": "^2.0.0", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-runtime": "^6.12.0", "babel-preset-es2015": "^6.14.0", "babel-preset-react": "^6.22.0", "babel-preset-stage-0": "^6.5.0", "babel-register": "^6.22.0", "babel-runtime": "^6.11.6",
Npm install will definitely solve the problem
Look to see if there is a .babelrc file. Have you forgotten this file?
In addition, the .babelrc file must have a react plugin.
First
npm install babel-plugin-import babel-plugin-react-transform --save-p
Then .babelrc must have at least these: ("stage-0" optional)
In fact, you can also install more, such as adding these to devDependencies in package.json
Npm install will definitely solve the problem