-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Error fn is not a function
when Astro.glob in a TS file
#5552
Comments
Tried to quickly debug this on my end and it seems like importMetaGlobResult here is somehow an array of strings instead of being an array of imports. I'm guessing this happens because in a .ts files Astro.glob doesn't get processed correctly or something like that (or processed at all, now that I think about it. Our Vite plugin only works inside Astro files) If we can't fix the underlying problem, we should at least provide a better error message pointing towards using |
getStaticPathFromContentType add a standardized way to get static path. But the function throw an obscure error when used in TS files, See this issue -> withastro/astro#5552
getStaticPathFromContentType add a standardized way to get static path. But the function throw an obscure error when used in TS files, See this issue -> withastro/astro#5552
fn is not a function
when passing Astro to a TS filefn is not a function
when Astro.glob in a TS file
I think this is expected as documented at https://docs.astro.build/en/reference/api-reference/#astroglob. Closing this for now. |
Actually we could have better error messages when detecting the value that's passed in to |
What version of
astro
are you using?1.6.13
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
NPM
What operating system are you using?
Tested on Linux, Mac & Windows
Describe the Bug
Hi guys !
I tried to use
await Astro.glob
inside a TS file by passing Astro as an argument. Throw the error "FN is not a function", looks like a Vite-related problem.The same function works like a charm when in an Astro file.
Error log
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-xlqiz4?file=src/utils.ts
Participation
The text was updated successfully, but these errors were encountered: