I would like to be able to import .html file as a string template in NestJS application. In order to satisfy TypeScript I created text.d.ts like this:
declare module "*!text" {
const content: string;
export default content;
}
and imported it in a file like this:
import html from 'src/templates/test!text';
There are no complains from TypeScript. However when I try to run the application I get the following error:
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'src/templates/test!text'
How to solve this error?
Thanks in advance.