Eric Burel @ericburel.tech · Feb 22

I've crafted a separate file "src/fetcher/surveyWithSitemap", so I can import it and use it in getStaticPaths safely, and again in the actual page to get the data I am using an "astro" prefix in the function name: this way I can tell exactly which functions returns data that are safe to render!

0 likes 1 replies

?

Replies

Eric Burel · Feb 22

Now time to import it. Out-of-the-box, you have to use relative imports like "../../../../fetchers/surveyWithSitemap.ts", that's dull Hopefully Astro supports import aliases, it just needs a line in the tsconfig.json docs.astro.build/en/guides/ty... Now "@/fetchers/surveyWithSitemap" will work