Skip to content

Generated code lacks a space when FormattedMessage is on one line #6164

@dhshah

Description

@dhshah

Which package?

Since this is a monorepo. Please specify which package this bug report is for.
@formatjs/unplugin
@formatjs/vite-plugin

Presumably others added in #6096.

Describe the bug

A clear and concise description of what the bug is.
This doesn't work:

<FormattedMessage description="Test" defaultMessage="Test" />

The generated code lacks a space:

 <FormattedMessagedefaultMessage={[{"type":0,"value":"Test"}]} />

To Reproduce

create a test case with

<FormattedMessage description="Test" defaultMessage="Test" />

Expected behavior

The message should be formatted either way.
The generated code does not add a space.

Additional context

If a formatted message is split across multiple lines, it works fine. EG:

<FormattedMessage
  defaultMessage="Test"
/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions