Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is webpack code splitting and chunking the same thing?

Tags:

webpack

I've seen webpack articles discussing code splitting and other articles discussing chunking. Aren't they the same thing?

Code splitting is one of the most compelling features of webpack. This feature allows you to split your code into various bundles which can then be loaded on demand or in parallel. It can be used to achieve smaller bundles and control resource load prioritization which, if used correctly, can have a major impact on load time.

There are three general approaches to code splitting available:

Entry Points: Manually split code using entry configuration.

Prevent Duplication: Use the CommonsChunkPlugin to dedupe and split chunks.

Dynamic Imports: Split code via inline function calls within modules. Webpack documentation

like image 772
dlaub3 Avatar asked Oct 11 '25 07:10

dlaub3


1 Answers

They are, sort of.

According to the docs, splitting is the action (verb), and chunks are what splitting produces (noun).

like image 150
Rick Avatar answered Oct 14 '25 10:10

Rick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!