diff --git a/tools/broccoli/broccoli-typescript.ts b/tools/broccoli/broccoli-typescript.ts index b4581b3029..beb0f58a47 100644 --- a/tools/broccoli/broccoli-typescript.ts +++ b/tools/broccoli/broccoli-typescript.ts @@ -41,6 +41,7 @@ class DiffingTSCompiler implements DiffingBroccoliPlugin { this.tsOpts = Object.create(options); this.tsOpts.outDir = this.cachePath; this.tsOpts.target = (ts).ScriptTarget[options.target]; + this.tsOpts.module = (ts).ModuleKind[options.module]; this.tsOpts.experimentalDecorators = true; this.rootFilePaths = options.rootFilePaths ? options.rootFilePaths.splice(0) : []; this.tsServiceHost = new CustomLanguageServiceHost(this.tsOpts, this.rootFilePaths, diff --git a/tools/broccoli/trees/browser_tree.ts b/tools/broccoli/trees/browser_tree.ts index ecb3214948..93653fd77b 100644 --- a/tools/broccoli/trees/browser_tree.ts +++ b/tools/broccoli/trees/browser_tree.ts @@ -83,6 +83,15 @@ module.exports = function makeBrowserTree(options, destinationPath) { ], destDir: '/' }); + + var es5ModulesTree = new Funnel('modules', { + include: ['**/**'], + exclude: [ + '**/*.cjs', + 'benchmarks/e2e_test/**' + ], + destDir: '/' + }); var scriptPathPatternReplacement = { match: '@@FILENAME_NO_EXT', @@ -108,12 +117,20 @@ module.exports = function makeBrowserTree(options, destinationPath) { sourceRoot: '.', target: 'ES6' }); - - // Call Traceur to lower the ES6 build tree to ES5 - var es5Tree = transpileWithTraceur(es6Tree, { - destExtension: '.js', - destSourceMapExtension: '.js.map', - traceurOptions: {modules: 'instantiate', sourceMaps: true} + + // Use TypeScript to transpile the *.ts files to ES5 + var es5Tree = compileWithTypescript(es5ModulesTree, { + allowNonTsExtensions: false, + declaration: false, + emitDecoratorMetadata: true, + experimentalDecorators: true, + mapRoot: '', // force sourcemaps to use relative path + module: 'System', + noEmitOnError: false, + rootDir: '.', + sourceMap: true, + sourceRoot: '.', + target: 'ES5' }); // Now we add a few more files to the es6 tree that Traceur should not see diff --git a/tools/broccoli/trees/node_tree.ts b/tools/broccoli/trees/node_tree.ts index 6696a75ec8..7945357262 100644 --- a/tools/broccoli/trees/node_tree.ts +++ b/tools/broccoli/trees/node_tree.ts @@ -34,7 +34,7 @@ module.exports = function makeNodeTree(destinationPath) { experimentalDecorators: true, declaration: false, mapRoot: '', /* force sourcemaps to use relative path */ - module: 'commonjs', + module: 'CommonJS', noEmitOnError: true, rootDir: '.', rootFilePaths: ['angular2/traceur-runtime.d.ts', 'angular2/globals.d.ts'],