I have a json files in public/assets/i18n
Now I’m using fetch to get the file.
Here is how I’m doing it:
try {
response = await fetch(../../../assets/i18n/${browserLanguage}.json
);
res = await response.json();
return res;
} catch (error) {
// error handling
}
In local its working fine and I see the fetch url is “http://localhost:3000/assets/i18n/en.json”
but in env, i don’t get the whole url instead i see only domain url and not the whole path.
I see something like “https://dev.com/portal/”
And I think this is the reason why its not able to fetch the json files.
what can i do here to get this work, or any alternative process to read json files in js?