问题
How can I combine multiple files into a single module ? Say I have a folder with multiple typescript classes e.g.
app
module1
foo1.ts
foo2.ts
....
module1.ts
In any classes which uses any of the module1 defined classes, I would like to be able to include the dependencies using a single import like
import {Foo1, Foo2} from "./module1/module1"
rather than importing individual classes like
import {Foo1} from "./module1/foo1"
import {Foo2} from "./module1/foo2"
How can I do this ?
回答1:
Not sure if this is the correct way, but it seems to work for what I need in module1.ts simply define export for the classes
export * from "./foo1";
export * from "./foo2";
来源:https://stackoverflow.com/questions/36531127/requirejs-typescript-combine-multiple-classes-into-a-single-module