Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikfranki/react-dev-and-prod
Webpack + React 系列配置
https://github.com/nikfranki/react-dev-and-prod
babel less react react-router webpack2
Last synced: 26 days ago
JSON representation
Webpack + React 系列配置
- Host: GitHub
- URL: https://github.com/nikfranki/react-dev-and-prod
- Owner: NikFranki
- Created: 2018-03-06T13:18:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-03-07T01:48:51.000Z (over 6 years ago)
- Last Synced: 2024-10-11T13:23:32.410Z (26 days ago)
- Topics: babel, less, react, react-router, webpack2
- Language: JavaScript
- Homepage:
- Size: 145 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## React + Webpack 系列配置
React + Webpack 区分开发、生成环境的打包配置,开发环境下配置热更新、公共文件、第三方文件抽取、代码分割、按需加载、自动生成html模板文件并导入对应的css和js文件,生成环境进行了压缩混淆、其他与开发环境类似;
## 运行
为了项目的正确运行,请确保 npm 或 yarn 已经安装
```sh
# 安装项目依赖
npm install 或 yarn install
# 运行项目
npm start 或 yarn start
```## 打包
生产环境打包需要使用以下命令
```sh
# 生成dist目录
npm run build:prod 或 yarn build:prod
# dist目录挂载的服务器
npm run prod 或 yarn prod
```### 参考资料
- [Webpack docs](https://webpack.js.org/concepts/)
- [webpack 多页面构建](https://github.com/shaozj/blog/issues/11)