组件源代码
- src/layout/config 添加配置
- src/pages 添加组件演示代码
- src/Routers.jsx 添加演示代码路由
- src/components 添加组件源代码
- src/pages 引入 src/components中的组件
- 查看 src/pages 预览
- 完整 src/components 和 src/pages 代码
|-- component |-- components 组成组件 | |-- A.tsx 组件组件A | |-- B.tsx 组件组件B |-- config 组件配置 | |-- config.ts 组件配置数据 | |-- interface.ts 组件配置接口类型 | |-- util.ts 工具函数 |-- Component.tsx 组件组成源码 |-- index.tsx 组件输出
- babel-plugin-import 安装
- package.json babel 填入
{
"plugins": [
[
"import",
{
"libraryName": "antd",
"libraryDirectory": "es",
"style": "css"
}
]
]
}
- 安装stylus相关loader
执行 npm install stylus stylus-loader --save-dev
或 yarn add stylus stylus-loader
- webpack.config.js 配置stylus
- webpack.config 配置 alias
- tsconfig.json 配置 paths
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
- 重启IDE才生效
- 安装 prettier-now
- setting设置
- 在webpack.config.js 里面有个eslint-loader的配置, cache属性设置的是 true, 把它修改为false, 重启, 你修改的eslintrc就可以生效了