Closed
Description
Would anyone be interested in a PR for bundling ES6 modules into single IFFE-scoped files? (a la rollup.js) This would allow bundling for those who don't wish to rely on AMD/System, and remove at least one build step in many scenarios.
(Apologies if duplicate. Search/FAQ didn't come up with anything. If additional details are desired, I can put those together as well)
Example below (modified from rollupjs's website):
//main.ts (source)
import * as x from './maths';
var z : number = 3;
console.log( x.cube( 5 ) + z );
//maths.ts (source)
//variable namespacing could be accomplished by appending, as seen here, or via internal IFFEs
var z : number = 0;
export function square ( x : number ): number {
return x * x + z;
}
//unreferenced functions intelligently culled
export function cube ( x : number ): number {
return x * x * x + z;
}
//main.js (outFile)
(function () {
'use strict';
//variable namespacing could be accomplished by appending, as seen here, or via internal IFFEs
var z$1 = 0;
//unreferenced functions intelligently culled
function cube ( x ) {
return x * x * x + z$1;
}
var z = 3;
console.log( cube( 5 ) + z );
}());