How to render template literals without using new Function because chrome extension manifest v3 does not permit unsafe-eval

I made a chrome extension with the v2 manifest that uses a lot of template literals coming from json files. I was rendering them using new Function which made it so easy. But with chrome extension manifest v3, it is impossible to use new Function. Would anyone have any suggestion that wouldn’t require a huge refactor?

Here’s an example of how I was using new Function to render the template literals. It is sad that this isn’t permitted because I was wrapping the whole expression with backticks so I don’t really see a problem using new Function in that case.

function renderTemplate(expression, data) {
  return new Function("data", "return " + "`" + expression + "`")(data);
}

const json = {
  "test":"Hi I'm ${data.name}. It's ${data.time} and I'm almost ${data.age} years old."
};

const renderedTemplate = renderTemplate(json.test, { name: "Patrick", age: 30, time: "3pm" });
console.log(renderedTemplate); // Hi I'm Patrick. It's 3pm and I'm almost 30 years old.

I know that it is possible to run a sandbox page within the extension that could execute the new Function but it requires to use postMessage between two scripts so it’s asynchronous and I’d prefer to avoid that.

I also read about pre-compiling the templates or use tagged templates but that means an iportant refactor of my code.

I’d just like to find a way to render the template strings without using new Function with minimal change to my code.