There's honestly been a debate about how much javascript-generated sites affects SEO. A few years ago, I would have said it impacts it quite a bit, but with the popularity of frameworks such as Angular & Ember gaining steam, not so much anymore.
https://searchengineland.com/tested-googlebot-crawls-javascript-heres-learned-220157Now Google may handle OK w/ javascript, but other search engines MAY NOT react in the same way.
As mentioned above, if it's just loading templates, I would more likely recommend server generated code for this. Such as PHP. It's really not that difficult, and can be embedded right into your HTML code. Probably even more easily than Javascript (and less client-side work to be done)
<html>
<head></head>
<body>
<div id="header">
// Replace / with question mark because Cloudflare doesn't like it.
</php include('header-links.php'); />
</div>
<div id="content"></div>
<div id="footer"></div>
</body>
</html>