-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove "imports on top" warning #1001
Conversation
✅ Deploy Preview for astro-docs-2 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Does this change also affect the
|
I don’t think that was ever impacted by order in the frontmatter? Or if it was, it hasn’t been like that for quite a while. |
It absolutely affected me, not that long ago, tbh, fwiw! |
Oh, interesting! Just tried it and definitely doesn’t seem to be the case here: https://stackblitz.com/edit/github-cjkpls?file=src/pages/index.md Or was this with |
@@ -11,16 +11,17 @@ Astro provides several different tools to help you troubleshoot and debug your c | |||
|
|||
Here are some common error messages you might see in the terminal, what they might mean, and what to do about them. | |||
|
|||
### Transform failed with X error | |||
### Transform failed with "Unexpected `export`" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking, is this exactly how the error message is presented? Quotation marks and code styling? I think we did that before, where the message would read the way it would be seen by the user.
Marking as draft, since it feels like another free-for-all Friday coming on, and I know this is still blocked upstream! |
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
|
||
This message often appears due to a current limitation in Astro requiring your import and export statements to be at the top of your `.astro` file. | ||
A current limitation in Astro is that `export` statements (other than `getStaticPaths()`) are not supported in `.astro` files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticing that this still doesn’t mention Prop
:
A current limitation in Astro is that `export` statements (other than `getStaticPaths()`) are not supported in `.astro` files. | |
A current limitation in Astro is that `export` statements (other than `getStaticPaths()` and `Props`) are not supported in `.astro` files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this entirely. This limitations was actually removed in withastro/compiler#463. I opened withastro/astro#4003 to provide a better error hint in context for export
hoisting issues, since export
can cause reference errors. We'll keep an eye out for this and can put that error message here if users have trouble.
An actionable hint is provided in-context via withastro/astro#4003
### Transform failed with X error | ||
|
||
This message often appears due to a current limitation in Astro requiring your import and export statements to be at the top of your `.astro` file. | ||
|
||
**Solution**: Write your imports and exports at the top of your component script. | ||
|
||
**Status**: Current limitation; fix is being worked on. | ||
|
||
**Not sure that this is your problem?** | ||
Check to see if anyone else has reported [this issue](https://github.com/withastro/astro/issues?q=is%3Aissue+is%3Aopen+Transform+failed+with+*+error)! | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this since it's no longer relevant, nor is the Unexpected export
error that I originally replaced it with.
withastro/astro#4003 will provide helpful hints in-context if a user does run into an error due to export
hoisting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aww... bye bye TOP NUMBER ONE ERROR. 🥲
I think this LGTM, Nate! |
What kind of changes does this PR include?
Description
.astro
files!