Splitting single modules

Can modules be split apart based on export usage?

Person in labcoat walking left


Code Splitting refers to the process of distributing groups of modules into smaller bundles that can be linked together at runtime, avoiding loading code not used by the current state of an application. However, individual modules can grow to be quite large. Some of the most common cases where this is true are "index" modules that re-export many other modules to simplify library usage, or modules that export data like configuration or locale definitions.

When grouping modules, it's common for different subsets of a module's exports to be used by different bundles. In certain cases, it is possible to analyze modules and split them apart based on which exports are needed for each generated bundle. Breaking these large modules apart allows for each group of bundles to contain only the code necessary for that group.

Use the (+) card below & tell us if we missed a capability!

Plant with tall leafs and vines in a pot

Questions or Concerns?

We want to hear from you, let us know how to make this better. Open up a GitHub issue and we’ll track it there. Thanks!

Open a GitHub Issue