-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
"Top-level return cannot be used inside an ECMAScript module" #5922
Labels
- P4: important
Violate documented behavior or significantly impacts performance (priority)
Comments
And, in fact, this one was caused by an underlying error on the |
natemoo-re
added a commit
that referenced
this issue
Jan 30, 2023
natemoo-re
added a commit
that referenced
this issue
Jan 30, 2023
Co-authored-by: Nate Moore <[email protected]>
I get this error from the following code: return new Response(null, {
status = 401,
}); When running node, I get this error (which should probably be the same in this case):
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of
astro
are you using?1.9.2
Are you using an SSR adapter? If so, which one?
Node
What package manager are you using?
npm
What operating system are you using?
Linux
Describe the Bug
I'm getting a "Top-level return cannot be used inside an ECMAScript module" error. When trying to reduce the error, it appears to go away once I simplify the surrounding code enough, so I suspect it's caused by the presence of another error. However, that means the real error is replaced by this incorrect one, which makes it hard to fix the other error. See the stackblitz below for the complex reproduction.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-hz21xe?file=src/pages/[...crawl_date].astro
Participation
The text was updated successfully, but these errors were encountered: