Skip to content

[Feature Request]: add optimization.inlineConst: 'safe' #5535

@sapphi-red

Description

@sapphi-red

What problem does this feature solve?

The current optimization.inlineConst option only takes false or true, which is difficult to use as a default for rolldown-vite as true may generate a bigger bundle.

Having an option that will reduce the bundle size in most cases would help for that. I think it's ok to have some cases being bigger.

Some ways I can think of are:

  • inline based on some conditions like Oxc's minifier does
  • actually try inlining it and check the length somehow

or maybe only handle the value duplication on Rolldown side and let the minifier inlinine the values (#4246 (comment))

What does the proposed API look like?

Change optimization.inlineConst to receive 'safe' as well.
(Maybe it should be a different name than 'safe')

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions