Skip to content

🐛 BUG: Unable to map a td inside a table tr #428

@QuentinWidlocher

Description

@QuentinWidlocher

What version of astro are you using?

1.0.0-beta.44

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

When trying to map over an array to produce multiple td inside a tr inside a table, Astro crashes with an error that's not really useful for the user (the line number doesn't match the actual file and the error itself does not correspond to the code).

<table>
    <tr>
        {[0,1,2].map(x => (
            <td>{x}</td>
        ))}
    </tr>
</table>
Transform failed with 1 error:
/home/projects/github-rrohxf/src/pages/index.astro:31:6: ERROR: Expected ")" but found "}"

Error: Transform failed with 1 error:
/home/projects/github-rrohxf/src/pages/index.astro:31:6: ERROR: Expected ")" but found "}"
    at failureErrorWithLog (/home/projects/github-rrohxf/node_modules/esbuild/lib/main.js:1557:15)
    at start/< (/home/projects/github-rrohxf/node_modules/esbuild/lib/main.js:1346:29)
    at sendRequest/< (/home/projects/github-rrohxf/node_modules/esbuild/lib/main.js:637:17)
    at handleIncomingPacket (/home/projects/github-rrohxf/node_modules/esbuild/lib/main.js:73&#8230;

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-rrohxf?file=src/pages/index.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P3: minor bugAn edge case that only affects very specific usage (priority)table

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions