Astro Info
Astro v6.1.2
Vite v7.3.1
Node v22.12.0
System macOS (arm64)
Package Manager npm
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When a template contains .flatMap() or .map() expressions that assign JSX to variables and return arrays, the Rust compiler outputs raw JSX instead of wrapping it in $$render...`` tagged template literals. This produces invalid JavaScript that Rollup cannot parse.
The Go compiler correctly wraps all template expressions — including deeply nested ones inside callbacks — in tagged template literals.
Template pattern that triggers the bug:
{features.flatMap((feature) => {
const mainRow = (
<tr><td>{feature.title}</td></tr>
);
const detailRows = feature.description
? feature.description.map((line) => (
<tr><td>{line}</td></tr>
))
: [];
return [mainRow, ...detailRows];
})}
Rust compiler output (invalid — raw JSX):
const mainRow = (
<tr>
<td>{feature.title}</td>
</tr>
);
Go compiler output (correct — tagged template literal):
const mainRow = (
$$render`<tr>
<td>${feature.title}</td>
</tr>`
);
Build error:
Expression expected (Note that you need plugins to import files that are not JavaScript)
What's the expected result?
he Rust compiler should wrap JSX inside callback expressions with $$render tagged template literals, matching the Go compiler's behavior.
Link to Minimal Reproducible Example
https://github.com/scottvrable/astro-rust-compiler-repro
Participation
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When a template contains
.flatMap()or.map()expressions that assign JSX to variables and return arrays, the Rust compiler outputs raw JSX instead of wrapping it in$$render...`` tagged template literals. This produces invalid JavaScript that Rollup cannot parse.The Go compiler correctly wraps all template expressions — including deeply nested ones inside callbacks — in tagged template literals.
Template pattern that triggers the bug:
Rust compiler output (invalid — raw JSX):
Go compiler output (correct — tagged template literal):
Build error:
Expression expected (Note that you need plugins to import files that are not JavaScript)What's the expected result?
he Rust compiler should wrap JSX inside callback expressions with
$$rendertagged template literals, matching the Go compiler's behavior.Link to Minimal Reproducible Example
https://github.com/scottvrable/astro-rust-compiler-repro
Participation