fix(bazel): downlevel decorators in fesm5 files (#23078)

Needed so that our bundles appear side-effect-free to tools like webpack

PR Close #23078
This commit is contained in:
Alex Eagle
2018-03-29 18:21:40 -07:00
committed by Igor Minar
parent 45e090b614
commit 481b22ecb0
4 changed files with 55 additions and 72 deletions

View File

@ -23,10 +23,13 @@ function main(args) {
const data = JSON.parse(fs.readFileSync(input, {encoding: 'utf-8'}));
data['compilerOptions']['target'] = 'es5';
data['bazelOptions']['es5Mode'] = true;
data['bazelOptions']['tsickle'] = false;
// Enable tsickle for decorator downleveling only
data['bazelOptions']['tsickle'] = true;
data['bazelOptions']['tsickleExternsPath'] = '';
data['compilerOptions']['outDir'] = path.join(data['compilerOptions']['outDir'], newRoot);
if (data['angularCompilerOptions']) {
// Don't enable tsickle's closure conversions
data['angularCompilerOptions']['annotateForClosureCompiler'] = false;
data['angularCompilerOptions']['expectedOut'] =
data['angularCompilerOptions']['expectedOut'].map(
f => f.replace(/\.closure\.js$/, '.js').replace(binDir, path.join(binDir, newRoot)));