react起始模版
webpack@4 + redux + react-router@5 + react-hot-loader@4
app目录
+-- actions
+-- components
+-- containers
| +-- devtools
| +-- root
| | +-- dev.jsx
| | +-- index.jsx
| | +-- prod.jsx
| +-- app.js
+-- images
+-- pages
| +-- app.jsx
| +-- app.scss
+-- reducers
+-- sagas
+-- store
+-- apis.js
+-- index.jsx
+-- routes.js
public目录存放html模板(handlebars)和不需要经模块系统处理的资源(使用copy-webpack-plugin复制到dist目录)
.env文件配置
# devserver
HOST=localhost
PORT=8080
# html文件名
INDEX=index.html
serve配置在serve.json
image-webpack-loader依赖libpng,缺少会报错,tcoopman/image-webpack-loader#142
# osx
brew install libpng
# ubuntu
sudo apt-get install libpng16-dev
安装依赖
- Webpack Configuration
- webpack releases page
- React Hot Loader
- Starter Kits
- React Router
- react-router-redux
- Redux DevTools
- Building for Production
- Caching
- Analysing and minimising the size of client side bundle with webpack and source-map-explorer
- HTML Webpack Plugin
- webpack 4: released today!!
- redux-immutable-state-invariant