I don't have an opinion about pnpm per se but I would suggest that you change your usage of "memory" for "disk space". "pnpm saves gigabytes of _disk space_".
I know in some languages the two can be interchangeable so that's why i'm pointing it out.
What typically happens when your templating engine is limited - on purpose or not - is that you transform your model into a kind of view model where you've applied the necessary logic (and boiled it down to boolean values, more or less).
Years ago there were so many "logic in templates is evil" articles, it seems the pendulum has swung back to "it depends".