TypeScript allows to bundle output into a single file using outFile compiler option.
This can be very useful to create single file bundle for web and you might not even need webpack for more simple applications.
One problem that needs to be resolved is module-loader. If we use "module": "amd" compiler option,
typescript output will use requirejs specification to define modules.
Full requirejs specification is a bit longer, and includes asynchronous script loading. Since
we don't need asynchronous script loading we can make simplified implementation. One such simplified implementation
of requirejs specs is almondjs.
Howeverif our goal is to oonly support typescript we potentially could have even simpler implementation:
- no need for async, already mentioned
- In requirejs specs there is some flexibility in the way define accepts arguments, we dont need this flexibility so we only need to write the code for the interface used in typescript output.
- we don't need to implement
require.config()
In this gist you can see absolute-minimum implementation of requirejs in the index.html that can work with some
typescript applications.