0.1.1 • Published 5 years ago
react-scripts-shopee v0.1.1
react-scripts-shopee
更加完善的 react-scripts 模板
使用
生成工程
- 首先安装 create-react-app 工具:
npm i -g create-react-app
create-react-app 工程名 --scripts-version react-scripts-shopee --typescript
, 包管理默认使用 yarn , 如果需要使用 npm , 需要加上--use-npm
参数
- 首先安装 create-react-app 工具:
eject 配置
npm run eject
- 本地开发
npm start
- 构建
npm run build
- modern build 构建
npm run build:modern
- 分析代码包
npm run analysis
- 预渲染
npm run prerender
特性
- 引入typescript
- 引入react-router, redux, redux-saga
- 基于webpack 4
- 使用css-modules
约定 .module.css 为 css module 文件, .css 为 全局 css 文件 - 移动端样式兼容
如果是移动端开发项目,视需要,在public/index.html 中 去除 buggyfill 和 fastclick 的代码注释,在 webpack.config.prod.js -> postcss-loader 中 去除 相关兼容移动端的 postcss插件 的代码注释 - 拆包及按需加载
- 对polyfill的按需引入
- 根据type=module构建出不同版本
- 骨架屏组件支持