build: delete rxjs d.ts files referencing rxjs-compat (#33786)
In order to speed up bazel build performance delete all rxjs d.ts files that reference rxjs-compat. For all ts_library and ng_module rules Bazel generates tsconfig.json file that explicitly lists all d.ts files found in required npm package. In case of rxjs, this means that tsconfig contains all d.ts files that reference rxjs-compat package, which is an interop/backwards compatibility package not installed in angular/angular repo. But because tsconfig contains these d.ts files, tsc will try to resolve them and silently fail. All these lookups are quite expensive and not cached. This causes significant slowdown of the build under bazel. This change removes all of these problematic rxjs d.ts files via an npm postinstall hook. This is not ideal because it solves the problem only for our repo, but it's a good start. Build perf improvements per target: //packages/core/src/reflect:reflect 5sec => 3 sec //packages/core:core 17sec => 12 sec //packages/router:router 30sec => 8 sec PR Close #33786
This commit is contained in:
parent
0fecea1427
commit
7df7e340ce
|
@ -20,7 +20,7 @@ try {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const {set, cd, sed, echo, ls} = require('shelljs');
|
const {set, cd, sed, echo, ls, rm} = require('shelljs');
|
||||||
const {readFileSync} = require('fs');
|
const {readFileSync} = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const log = console.log;
|
const log = console.log;
|
||||||
|
@ -68,4 +68,37 @@ ls('node_modules/@types').filter(f => f.startsWith('babel__')).forEach(pkg => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
log('\n# patch: delete d.ts files refering to rxjs-compat');
|
||||||
|
// more info in https://github.com/angular/angular/pull/33786
|
||||||
|
rm('-rf', [
|
||||||
|
'node_modules/rxjs/add/',
|
||||||
|
'node_modules/rxjs/observable/',
|
||||||
|
'node_modules/rxjs/operator/',
|
||||||
|
// rxjs/operators is a public entry point that also contains files to support legacy deep import
|
||||||
|
// paths, so we need to preserve index.* and package.json files that are required for module
|
||||||
|
// resolution.
|
||||||
|
'node_modules/rxjs/operators/!(index.*|package.json)',
|
||||||
|
'node_modules/rxjs/scheduler/',
|
||||||
|
'node_modules/rxjs/symbol/',
|
||||||
|
'node_modules/rxjs/util/',
|
||||||
|
'node_modules/rxjs/internal/Rx.d.ts',
|
||||||
|
'node_modules/rxjs/AsyncSubject.*',
|
||||||
|
'node_modules/rxjs/BehaviorSubject.*',
|
||||||
|
'node_modules/rxjs/InnerSubscriber.*',
|
||||||
|
'node_modules/rxjs/interfaces.*',
|
||||||
|
'node_modules/rxjs/Notification.*',
|
||||||
|
'node_modules/rxjs/Observable.*',
|
||||||
|
'node_modules/rxjs/Observer.*',
|
||||||
|
'node_modules/rxjs/Operator.*',
|
||||||
|
'node_modules/rxjs/OuterSubscriber.*',
|
||||||
|
'node_modules/rxjs/ReplaySubject.*',
|
||||||
|
'node_modules/rxjs/Rx.*',
|
||||||
|
'node_modules/rxjs/Scheduler.*',
|
||||||
|
'node_modules/rxjs/Subject.*',
|
||||||
|
'node_modules/rxjs/SubjectSubscription.*',
|
||||||
|
'node_modules/rxjs/Subscriber.*',
|
||||||
|
'node_modules/rxjs/Subscription.*',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
log('===== finished running the postinstall-patches.js script =====');
|
log('===== finished running the postinstall-patches.js script =====');
|
||||||
|
|
Loading…
Reference in New Issue