Closed anti-captcha closed 9 months ago
You're right that the module generates routes for each page in each language depending on the configured strategy, as far as I'm aware there's no way to reduce this further.
Without seeing your project I can't tell if the repeated null checks in your entry file sample are necessary. I think if these pages are not using definePageMeta
these checks should be tree-shaked out of the build, which should bring your entry file down a bit.
I think when/if this https://github.com/nuxt/nuxt/pull/25210 gets merged it may also be an option to bring down the build size further.
Thank you for your quick answer. Yes I'm using definePageMeta
for defining layouts.
Since the file size of the generated routes is mostly dependent on the implementation upstream in Nuxt and Vue Router I'll be closing this. I do have an idea on how we can reduce this from Nuxt's side, so I'll look into that and refer to this issue if it pans out 😄.
My Nuxt 3 entry file grew to 800kb, 700kb of which are repeating lines like this:
{ name: (v == null ? void 0 : v.name) ?? "apidoc-methods-getResellerData___vi", path: (v == null ? void 0 : v.path) ?? "/vi/apidoc/methods/getResellerData", meta: v || {}, alias: (v == null ? void 0 : v.alias) || [], redirect: (v == null ? void 0 : v.redirect) || void 0, component: () => r(() => import("./getResellerData.712f70af.js"), ["./getResellerData.712f70af.js", "./stores.77821267.js", "./components.1ed091d0.js", "./components.ab028930.css"], import.meta.url).then(i => i.default || i) }, { name: (v == null ? void 0 : v.name) ?? "apidoc-methods-getResellerData___ur", path: (v == null ? void 0 : v.path) ?? "/ur/apidoc/methods/getResellerData", meta: v || {}, alias: (v == null ? void 0 : v.alias) || [], redirect: (v == null ? void 0 : v.redirect) || void 0, component: () => r(() => import("./getResellerData.712f70af.js"), ["./getResellerData.712f70af.js", "./stores.77821267.js", "./components.1ed091d0.js", "./components.ab028930.css"], import.meta.url).then(i => i.default || i) }, { name: (v == null ? void 0 : v.name) ?? "apidoc-methods-getResellerData___uk", path: (v == null ? void 0 : v.path) ?? "/uk/apidoc/methods/getResellerData", meta: v || {}, alias: (v == null ? void 0 : v.alias) || [], redirect: (v == null ? void 0 : v.redirect) || void 0, component: () => r(() => import("./getResellerData.712f70af.js"), ["./getResellerData.712f70af.js", "./stores.77821267.js", "./components.1ed091d0.js", "./components.ab028930.css"], import.meta.url).then(i => i.default || i) }, { name: (v == null ? void 0 : v.name) ?? "apidoc-methods-getResellerData___id", path: (v == null ? void 0 : v.path) ?? "/id/apidoc/methods/getResellerData", meta: v || {}, alias: (v == null ? void 0 : v.alias) || [], redirect: (v == null ? void 0 : v.redirect) || void 0, component: () => r(() => import("./getResellerData.712f70af.js"), ["./getResellerData.712f70af.js", "./stores.77821267.js", "./components.1ed091d0.js", "./components.ab028930.css"], import.meta.url).then(i => i.default || i) }
So for every X amount of languages and Y amount of pages Nuxt generates X*Y records for each page, similar to above. Is there a way to reduce the size of the entry file?