Open ambigos1 opened 2 months ago
Should definitely be a possibility.
I have planned to look into the metaframework implementation of Paraglide JS. There are numerous complexities. I wonder if we can simplify some.
I added this issue to a "reduce metaframework complexities" project which should be worked on before the end of the year.
I think there is no need to load all the JS files with all the translations with all the languages since in the static-adapter all the pages got prerendered and it cost a lot from a performance perspective.
Is there a way I can remove the loading on those JavaScript files for static websites?
yep! if you find a way that works, I'll review an merge a PR!
i would look at the build output. theoretically, message functions (e.g. m.blue_moon()
) should be detected as static and be pruned away by the bundler. if that is not the case, we might need to tell vite that the function is OK to be pruned.
Can you guide me on where should I start looking for it in the code? Or can I pay someone to do it?
Can you guide me on where should I start looking for it in the code?
Less so in the code of paraglide js then your build output from your app.
Paraglide compiles messages to tree-shakable functions. In theory, bundlers like vite should tree-shake the function on a static build. If that doesn't happen, we might need to additional hints for bundlers like /#PURE/ https://webpack.js.org/guides/tree-shaking/#clarifying-tree-shaking-and-sideeffects.
You can test tree-shaking yourself by modifying the message function in the paraglide folder and see how your build output changes.
Or can I pay someone to do it?
You could put up a bounty with something like https://console.algora.io/. But, the timing would not be ideal. Paraglide JS 2.0 is ready but is waiting for lix 1.0. Modiying Paraglide 1.0 will be redundant effort.
I am currently using SvelteKit Static-Adapter and all my website are prerendered for all languages.
So there is no really need for JavaScript files that contains all the languages in run time when my website is deployed.
Is there a way to prevent downloading the JavaScript files with all languages on run time since they are generated on build time as static HTML files?
Looking for a way to get better performance and I added more than 10 languages.
Thank you all :)