Brief problem description: I'd like to use TypeScript to generate AMD-style named modules, which I then want to load from a bundled and minified file using requires.js.
Questions:
- Is that possible?
- Or do you suggest another approach?
I want to combine the benefits of having all scripts bundled and minified (so that no additional HTTP requests are necessary) with loading named AMD modules which are generated by TypeScript.
Update: I was thinking along the lines of the following JavaScript solution:
define("greeter", ["require", "exports", "jquery"], function(require, exports, $) {
function greet() {
alert("Hello World!");
}
exports.greet = greet;
});
Then I could bundle and minify the generated JavaScript modules into a file that could easily be cached by browsers. Also, require.js wouldn't have to go out there and grab the modules via several GET requests — they're already defined. Plus, I'd have all the advantages of using TypeScript to generate those modules.