There's a feature in TypeScript which I like so much and that's external modules using RequireJs and that the fact that the compiler won't include imported modules unless they are actually needed in the code. Here's an example:
import A = require('./A');
import B = require('./B');
var a = new A();
When you compile the above code using tsc --module amd example.ts
it will transcompile to:
define(["require", "exports", './A'], function(require, exports, A) {
var a = new A();
});
As you can see there's no sign of B
in the generated code. That's because B
was not actually used. As I said this feature is great but now I've got a scenario in which I need to include some of the external modules even though they are not actually used anywhere in the code.
Does anyone have any idea how to do that? To prevent any misunderstanding, I'm not looking for a way to disable this feature completely, just for some specific modules.