Skip to content

[Feature Request]: inline modules with small literals to reduce the number of modules #4246

@sapphi-red

Description

@sapphi-red

What problem does this feature solve?

When a module is imported from multiple entry points, that module is kept as a chunk even if it's small. This causes many chunks to be generated.
But for modules that only exports a literal, we can duplicate it still keeping the semantics, and put it inside multiple chunks.
https://stackblitz.com/edit/github-nci4o6nk-soq5kdny?file=src%2Ffoo.mjs

The problem happens commonly when multiple entries exists and an asset is imported by multiple entry modules.

What does the proposed API look like?

N/A (no API as this just improves the chunking mechanism)

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions