Reputation: 26392
I have a Typescript interface, an abstract class (which implements the interface), and a class that extends the abstract class. This Typescript library I'm building uses jQuery quite a bit and takes $
as an argument in it's constructor.
I'd like to use tsc
to compile this into Javascript classes that will be included using reactjs, targeting Webkit / Safari 537.
I'm using requirejs
to add jQuery and the generated library as follows:
define(["jquery","vham"],function ($,VHAM) {
alert('$: ' + $); // This exists
alert('VHAM: ' + VHAM); // This crashes
...
js/app/main.js
All of my library javascript code is output to js/lib/vham.js
; vham.js
is the output of the tsc
compiler. What settings are appropriate in tsconfig.json
for compiling my classes for use as a dependency included using requirejs?
Upvotes: 2
Views: 1144
Reputation: 822
RequireJS uses Asynchronous Module Definition (AMD). You would need to tell tsc to generate modules in AMD format. Specifically you will need to set the --module
flag to "AMD".
See the Typescript Compiler Options for more details:
https://www.typescriptlang.org/docs/handbook/compiler-options.html
Upvotes: 3