Skip to content

Disable styled components transform transpile_template_literals option by default? #13398

Description

@overlookmotel

Currently transpile_template_literals option is enabled by default:

/// Transpiles styled-components tagged template literals to a smaller representation
/// than what Babel normally creates, helping to reduce bundle size.
///
/// Converts `` styled.div`width: 100%;` `` to `styled.div(['width: 100%;'])`, which is
/// more compact than the standard Babel template literal transformation.
///
/// Default: `true`
#[serde(default = "default_as_true")]
pub transpile_template_literals: bool,

The purpose of this option is to produce more compact output than you get when transpiling template literals. But Oxc doesn't support down-levelling to below ES6, so template literals don't get transpiled. So this option produces longer code than the template literal you get without it.

Therefore, should we disable this option by default?

@Dunqing what do you think?

Metadata

Metadata

Assignees

Labels

A-transformerArea - Transformer / Transpiler

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions