nuxt-modules / og-image

Generate OG Images with Vue templates in Nuxt.
https://nuxtseo.com/og-image
366 stars 24 forks source link

Adding a custom font doesn't disable the previous added fonts #229

Open ptdev opened 3 days ago

ptdev commented 3 days ago

Hi,

I've previously commented on this but have since revisited and found out that there is apparently some sort of issue with using custom fonts.

When we don't define a font, the Inter font gets bundled as expected. If we then define a custom font (for example, Noto+Sans) then the bundle gets both Inter and Noto Sans. Then if we remove Noto+Sans and try yet another font, (say, Archivo), then the bundle now gets, Inter, Noto Sans and Archivo.

And on and on with the bundle apparently getting increasingly larger and larger. It appears as the module is not removing old fonts from the cache or something and they all keep getting added.

Only by deleting the .nuxt folder manually (although I'm guessing deleting the .nuxt/cache folder will suffice) we get the correct behavior if we pick the font we want the first time and then never add to it or change it

This was detected while running npx nuxi analyze

Let me know if you need any more info,

Cheers

harlan-zw commented 3 days ago

Hi, thanks for the issue.

This is just an artifact of the .nuxt folder being re-used. When you update Nuxt or are doing an actual deployment it will only contain the relevant font files.

Saying that, there is a fairly simple fix for this so may consider solving it as low priority.

ptdev commented 3 days ago

Hey,

Thanks. No big issue then.

The bigger one will now be that nuxt's analyze command then isn't really reflecting the actual production build as stated :confused:

Leaving this open but feel free to close it at your leisure. Cheers and thanks again 👍