compiler icon indicating copy to clipboard operation
compiler copied to clipboard

🐛 BUG: export split across multiple lines is erroneously an error

Open nhynes opened this issue 3 years ago • 1 comments

What version of astro are you using?

0.23.2

What package manager are you using?

pnpm

What operating system are you using?

Mac

Describe the Bug

If the first line of the frontmatter is export const = '...'; and the rvalue is long and gets moved to the next line due to e.g., prettier, esbuild will raise the following complaint:

 error: Unexpected "export"
    at failureErrorWithLog (/.../node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1493:15)
    at /.../node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1282:29
    at /.../node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:629:9
    at handleIncomingPacket (/.../node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:726:9)
    at Socket.readFromStdout (/.../node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:596:7)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:199:23)

Link to Minimal Reproducible Example

https://codesandbox.io/s/great-swanson-9gsjjn

nhynes avatar Mar 01 '22 07:03 nhynes

Looks like this works fine in plain esbuild, so I'm betting our compiler is outputting incorrect JS.

Moving to the compiler repo.

natemoo-re avatar May 10 '22 21:05 natemoo-re

Closing this as it's been fixed in recent versions!

See working reproduction https://stackblitz.com/edit/github-7bvguh?file=src%2Fpages%2Findex.astro

natemoo-re avatar Nov 16 '22 13:11 natemoo-re