Skip to content

basic code splitting #22

@underfin

Description

@underfin

Summary

The following will trigger code splitting.

  • entries
  • shared module
  • dynamic import
  • manual chunks option

Split Modules to chunk by entries

  1. Mark an entry that has a corresponding bit flag.
  2. Mark the entry bit flag of the module by iter entries. The entry bits flag of the module may be imported by multiple entries bit flag.
  3. Generate chunks for entries, and add the corresponding bit flag to the chunk.
  4. Iter modules to compare the entry bit flag of the module with the entry bit flag of already generated chunks.
  • If a chunk has an equal entry bit flag of the module and connect the module with the chunk.
  • Else generate a new chunk for the entry bit flag of the module and connect the module with the chunk.

Cross chunks symbol imports and exports

Dynamic import module generate a chunk

Scanned the dynamic import module added to entries.

Step implementation

  • split Modules to chunk by entries
  • cross chunks symbol imports and exports
  • dynamic import as entries
  • manual chunk object
  • manual chunk function

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions