This should not be too complicated because it doens't require much change from CommonJS. As an example, I've created a simple script that makes precompiled templates work with import. I'm running a client app (vanilla JavaScript with Vite).
I'm compiling my templates with CommonJS, and after that I run the script (package.json):
This should not be too complicated because it doens't require much change from CommonJS. As an example, I've created a simple script that makes precompiled templates work with import. I'm running a client app (vanilla JavaScript with Vite).
I'm compiling my templates with CommonJS, and after that I run the script (package.json):
This is the script hbs-replace.js:
The result (compiled.js):
And this is how it can be used from code (import):
Maybe this is not the most elegant way of exporting templates, but it's usable