Replies: 1 comment 1 reply
-
Where is |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When trying to use fetch in a tag <script context="module"> to get local json, the value obtained is empty. The json file is in the lib/static path. How should I solve this problem? Thank you!
"svelte": "^4.2.7"
<script context="module"> export async function load({ page, fetch }) { const res = await fetch(`/q.json`); const data = await res.json(); console.log(data); return { props: { data } }; } </script> <script lang="ts"> export let data; console.log(data); </script>Beta Was this translation helpful? Give feedback.
All reactions