Open bartlomiejzuber opened 5 months ago
This is an issue with esbuild
. I suggest filing an issue there: link to their playground
After looking at the response in the esbuild issue, it's clear this is an issue with the compiler.
Export statements are hoisted, which is a term we use for moving code such that it runs at the top-level instead of component-level. It seems like the the variable declaration itself is hoisted, but as const
is not, creating invalid typescript code.
Updated the issue description to focus on incorrect compilation.
What version of
@astrojs/compiler
are you using?2.8.1
What package manager are you using?
npm
What operating system are you using?
Linux
Describe the Bug
In this code sample, the export statement is hoisted, but
as const
is not.as const
is correctly hoisted if the const declaration is only takes up one line.Link to Minimal Reproducible Example
Live Astro Compiler