Skip to content

Inline variables into template strings during minification #2646

@benmccann

Description

@benmccann

The Svelte 5 compiler output will make heavy use of template strings. I'm looking at what it would be like to use oxc as part of our build process and one thing I noticed is that there are values that are not inlined that could be when using mangle and compress

Example:

const o = 'o';
const d = 'd';
const boolean = false;
var frag = `<p autocapitalize="${`w${o}r${d}s`}" contenteditable="${boolean}"> </p>`;

Today this outputs:

const o = 'o', d = 'd', boolean =  !1;
var frag = `<p autocapitalize="${`w${o}r${d}s`}" contenteditable="${boolean}"> </p>`;

But it could output:

var frag = `<p autocapitalize="words" contenteditable="false"> </p>`;

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions