-
-
Notifications
You must be signed in to change notification settings - Fork 109
nest does not work in production bundle #361
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingbundlingRelated to the way intlayer is bundled on application (Next.js, Vite.js, Nuxt.js, etc)Related to the way intlayer is bundled on application (Next.js, Vite.js, Nuxt.js, etc)
Description
I am facing the following issue: I have a common dictionary, and would like to reference some keys in smaller dictionaries. See attached code.
This works fine in vite dev server, however, does not work in the production bundle (vite build && vite preview) - the strings do not get rendered.
Common content:
import { type Dictionary, t } from "intlayer";
const commonContent = {
content: {
period: {
daily: t({ de: "Täglich", en: "Daily" }),
monthly: t({ de: "Monatlich", en: "Monthly" }),
weekly: t({ de: "Wöchentlich", en: "Weekly" }),
},
startPage: t({ de: "Startseite", en: "Start Page" }),
submit: t({ de: "Absenden", en: "Submit" }),
},
key: "common",
} satisfies Dictionary;
export default commonContent;concrete content:
import { type Dictionary, nest, t } from "intlayer";
const dashboardContent = {
content: {
period: nest("common", "period"),
submit: nest("common", "submit"),
},
},
key: "dashboard",
} satisfies Dictionary;
export default dashboardContent;usage:
const dashboard = useIntlayer("dashboard");
What works is this, but this goes against the purpose of the nesting function
import { type Dictionary, nest, t } from "intlayer";
import commonContent from "../content/common.content";
const dashboardContent = {
content: {
period: commonContent.content.period,
submit: commonContent.content.submit,
},
},
key: "dashboard",
} satisfies Dictionary;
export default dashboardContent;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingbundlingRelated to the way intlayer is bundled on application (Next.js, Vite.js, Nuxt.js, etc)Related to the way intlayer is bundled on application (Next.js, Vite.js, Nuxt.js, etc)