konsav
Switching from vue-i18n to @nuxtjs/i18n — Folder Structure & Dynamic Imports Issue
@kapa.ai just to clarify, my setup isn’t as simple as having two files per language — I actually have multiple translation files for each page of the app, organized in a folder structure like this:
So instead of just el.ts and en.ts, I need to dynamically load all these files while keeping the folder structure intact.
14 replies
NuxtImg from assets folder
@Kal thank you for your response. I use the Vite base because I have the same configuration previously.
Concerning your advice, I have the images inside assets folder and not in public folder.
This code now run on dev but not when i am running production. Its appear src="data:image/jpeg;base64,/9j/4AAQSkZ...
modules: ['@nuxt/image'],
image: {
provider: "ipx",
domains: [cdnMinUrl],
ipx: {
baseURL:
${baseUrl}_ipx
,
},
dir: "assets/img"
},
vite: {
base: ${cdnUrl}xonuxt/_nuxt/
,
},16 replies
middleware/redirect.global.js
export default defineNuxtRouteMiddleware(async (to, from) => {
const { $getApiData } = useNuxtApp();
if (to.path.includes("/test/") || to.path.includes("/test/abc")) {
const data = await $getApiData.fetchData(
$../redirect/url/${encodeURIComponent(
to.fullPath
)}
);
const response = decodeURIComponent(data);
await navigateTo(response, {
redirectCode: 301,
external: true,
});
}
});16 replies
Cache-Control: max-age=604800, public.
I add in server/plugin/header.ts
import { RenderResponse } from "nitropack";
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook("render:response", (res: RenderResponse, { event }) => {
res.headers["X-Frame-Options"] = "DENY";
res.headers["Cache-Control"] = "no-cache";
});
});
It adds in Cache-Control: no-cache but it appears max-age yet.
4 replies