// Input
class Foo {
    templateString = 'some value';
}
// Output
import __LIB__ from '@scope/lib/path/to/lib';
class Foo {
    templateString = (function compiledTemplate(deps) {
        // ...
        return result;
    })({lib: __LIB__});
}
Run Code Online (Sandbox Code Playgroud)
其实我有两个疑问:
PS我尝试了各种方法createSourceFile,ts.createImportDeclaration但它们都会导致这个或那个错误:[