Webpack + react Front-end engineering practice and temporary not extreme optimization

Source: Internet
Author: User

Technical structure

Webpack + react + react-router

Feature implementation about packaging

1. React-router-based custom packaging code split.
2. The sub-package is loaded asynchronously on demand.
3.CommonsChunkPlugin Public Code Package extraction.
4.ParallelUglifyPlugin multithreaded code compression.
5.HappyPack Multithreading loader task processing.
6.webpack Tree Shaking

Development model

1.express + webpack-dev-middleware + webpack-hot-middleware Local Development server and file modification hot load and real-time refresh.
2.mock data, Data.json interface and analog data configuration, effective in real time.
3. Nodejs-based HTTP module, to implement the local server HTTP request proxy forwarding, development mode directly request the test environment or the online Restfull API interface.

Business function Support

1. React-router-based page jump control
2. Configurable multi-level menu components
3. cookie-based permission control function
4. Client HTTP request Encapsulation
5. Introduction of Element-react, antd two common UI component libraries (common code extraction for element-react, ANTD component loading on demand)
6. Integration Less

Use instructions to install NPM dependencies
npm i --save
Development mode start (using Data.json mock data)
npm run dev
Development mode start (using proxy forwarding)
修改‘build/proxy.js‘的http option配置(hostname属性和header自定义配置)npm run dev --pxy
Production environment Packaging
‘build/config.js‘可对打包入口和输出路径做配置。npm run build

Git address: https://github.com/IveHD/web-project-go

Webpack + react Front-end engineering practice and temporary not extreme optimization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.