### 1.Babel and JSX
[相关地址](https://www.webpackjs.com/loaders/babel-loader/#%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3)
PS: yarn add babel-loader -D
PS: yarn add babel-core -D
不写命令了只写包:
~~~
babel-preset-env
babel-preset-react
babel-preset-stage-0
~~~
~~~
yarn add babel-loader@8.0.0-beta.0 @babel/core @babel/preset-env
~~~
### 2.启动
yarn start
得到下图结果:
![](https://box.kancloud.cn/a942b6f07d57874cae31811e88edbc38_815x519.png)
## 3.完整的package.json文件
```json
{
"name": "yarnReactWithWebpack",
"version": "1.0.0",
"description": "yarn+webpack+react",
"main": "index.js",
"author": "onions",
"license": "MIT",
"scripts": {
"build": "webpack --mode production",
"prestart": "yarn run build",
"start": "opener http://localhost:3008 & httpster -p 3008 -d ./dist"
},
"dependencies": {
"httpster": "^1.0.4",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"webpack": "^4.29.0"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "7.1.5",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"opener": "^1.5.1",
"webpack-cli": "^3.2.1"
}
}
```
- React进阶
- React进阶-组件 & Props
- React进阶-组件 & Props - 代码篇
- 组件扩展-组件生命周期
- 组件扩展-组件生命周期-代码篇
- React-Redux
- Redux入门教程-基本用法
- Redux入门教程-基本用法-代码篇
- Redux入门教程-中间件和异步操作
- Redux入门教程-React-Redux 的用法
- Redux入门教程-React-Redux的用法-代码篇
- ES6-变量的解构赋值
- 数组的解构赋值
- 对象的解构赋值
- React用法
- JSX技巧
- ES6-神奇的...
- yarn+webpack+react零基础创建项目
- 0-init
- 1-webpack.config.md
- 2-react相关依赖
- 3.编写react相关代码
- pnpx-react-config
- pnpx+create-react
- pnpm+react-config
- pnpm+react-antd