slinkity / slinkity

To eleventy and beyond! The all-in-one tool for templates where you want them, component frameworks where you need them 🚀

Home Page:https://slinkity.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Many same js files after generating many pages with same Vue component

Gospodin opened this issue · comments

Is your feature request related to a problem? Please describe.

Hello, I have project where one .njk produces many page with the same Vue component, after building I'm getting the site with huge amount of same js files, one per each page that was generated by previously described .njk file. It enlarge process of Vite stage building and doesn't allow browser to work with cached of version of same content file.

Describe the solution you'd like

It would be nice if Slinkity generated included js file only once per project and imported it on each page with the same component.

Describe alternatives you've considered

Cant imagine other solution.

Hi @Gospodin! Thanks for discovering this, since it's definitely not intended behavior. We're overhauling all component and asset generation right now to pull from "official" _assets and _islands folders in your project. Once this work is done, duplicate JS chunks should be impossible.

I'll keep this issue open for now for tracking once the 1.0 canary is out!

Hi @Gospodin! Thanks for discovering this, since it's definitely not intended behavior. We're overhauling all component and asset generation right now to pull from "official" _assets and _islands folders in your project. Once this work is done, duplicate JS chunks should be impossible.

I'll keep this issue open for now for tracking once the 1.0 canary is out!

Thanks @bholmesdev , is it possible in some hacky way to overcome this problem because it makes huge problem with
anomaly memory consumption while Vite transforming process?

@Gospodin well, there is a build caching improvement I've been planning on as well. Mind sending me a sample repo to test against?

Hi @bholmesdev , it looks like my mistake, I verified and saw that js files for components are generating only once, but there are many same files with component import in case of many pages with same component, so as option it would be nice to generate import files using some sort of caching not populating same files for many times, it also will allow better browser caching. Thanks.