Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
React学习手册
by
Alex Banks
,
Eve Porcello
December 2017
Intermediate to advanced
329 pages
6h 9m
Chinese
China Electric Power Press Ltd.
Content preview from
React学习手册
96
|
第
5
章
代码拆分
将代码拆分成不同的片段,使得用户可以按需加载它们。有时这种操作也被称为
汇总(
rollup
)或分层,其目标是为不同页面或者设备的需要对代码进行拆分打
包。
代码压缩
删除代码中的空格,换行符,冗长的变量名,以及不必要的代码,来达到减小文
件尺寸的目的。
特性标记
将代码发送到一个或者多个系统,测试代码的兼容性。
热替换(
HMR
)
监控源代码的变更,实时更新发生变更的模块。
webpack
加载器
加载器是一个函数,它主要的作用是帮助用户在构建过程中处理代码转换的问题。如
果我们的应用程序采用了
ES6
规范,
JSX
、
CoffeeScript
,以及其他不能被浏览器自动
解析的语言,那么我们将在文件
webpack.config.js
中声明必要的加载器来完成代码的
语法转换工作,从而达到让代码可以被浏览器自动解析的目的。
webpack
包含大量的加载器,并且可以分为几类。最常用的加载器是将某个语言的
一种方言转换成另外一种。比如
ES6
规范和
React
代码是通过其内置的加载器
babel-
loader
进行转译的。我们声明
Babel
将要处理的文件类型,然后其他工作就交给
webpack
完成即可。
另外一种比较常用的加载器是和样式表有关的。
css-loader
会查找扩展名为
.
scss
的
文件,然后将它们转译成
CSS
。
css-loader
还可以用来在用户的
bundle
中引用
CSS
模
块。所有的
CSS
代码将会打包成
JavaScript
,当打包文件中引用了
JavaScript
文件时,
系统会自动添加
CSS
代码。这样就不需要使用 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
React快速上手开发
Stoyan Stefanov
流畅的Python
Luciano Ramalho
C++语言导学(原书第2版)
本贾尼 斯特劳斯特鲁普
C++程序设计:原理与实践(基础篇)(原书第2版)
本贾尼 斯特劳斯特鲁普
Publisher Resources
ISBN: 9787519814236