基础插件安装,Less 文件加载配置
安装所需的插件:
- 安装 React-Router、Axios
- 安装 AntD
- 暴露 Webpack 配置
- 安装 less-loader(AntD 使用 less 开发)
- 修改 less-loader
npm install -g yarn(用npm全局安装yarn)
yarn --version(1.19.1)
yarn global add create-react-app@1.5.2(用yarn全局安装create-react-app)
create-react-app imoocmanager(初始化项目)
cd imoocmanager
yarn remove react react-dom react-scripts
yarn add react@16.3.2 react-dom@16.3.2 react-scripts@1.1.4
yarn add react-router-dom@4.2.2(安装新的 react-router)
yarn add axios@0.18.0 less-loader@4.1.0
此时 package.json:
{
"name": "imoocmanager",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "0.18.0",
"less-loader": "4.1.0",
"react": "16.3.2",
"react-dom": "16.3.2",
"react-router-dom": "4.2.2",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
暴露隐藏的配置(不可逆过程):