You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, multilingual content is packaged in index.js, but 99% of the multilingual content is not needed when the page is loaded, which causes the homepage to load slowly.
The main reasons for the large file size are as follows:
This project is large and has many functions.
There are descriptive texts on many pages, which do not need to be stored in the backend because they describe the meaning of a field and how to fill it out.
If component-level lazy loading is supported, and it is divided into different components like the routing package when packaging, then index.js will be much smaller.
Because there are many contents that are not universal and can only be used by a certain component.
Alternative
我目前是在 i18n 上基础上自己创建了一个 i18n.ts 解决的,例如这样:
I currently solved the problem by creating an i18n.ts based on i18n, for example:
But the disadvantage of this is that it is troublesome to use. Each component must write a similar set of content. And there is no way to use the i18n Ally plugin to increase readability.
Clear and concise description of the problem
目前会将多语言内容打包在
index.js
中,然而在页面加载时其中 99% 的多语言内容都是不需要的,导致首页加载缓慢。之所以文件很大主要有以下原因:
Currently, multilingual content is packaged in
index.js
, but 99% of the multilingual content is not needed when the page is loaded, which causes the homepage to load slowly.The main reasons for the large file size are as follows:
Suggested solution
如果可用支持组件级别的懒加载,类似打包时按照路由分包那样分在不同的组件内,那么
index.js
会小很多。因为有很多的内容都不是通用的,仅仅是某个组件才能用到。
If component-level lazy loading is supported, and it is divided into different components like the routing package when packaging, then
index.js
will be much smaller.Because there are many contents that are not universal and can only be used by a certain component.
Alternative
我目前是在 i18n 上基础上自己创建了一个
i18n.ts
解决的,例如这样:I currently solved the problem by creating an
i18n.ts
based on i18n, for example:但是这样有个弊端就是使用起来麻烦,每个组件都要编写一套类似的内容。并且无法使用
i18n Ally
插件来增加可读性。But the disadvantage of this is that it is troublesome to use. Each component must write a similar set of content. And there is no way to use the
i18n Ally
plugin to increase readability.Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: