88
99const fs = require ( 'fs' ) ;
1010const path = require ( 'path' ) ;
11+ const { packages } = require ( '../lib/packages' ) ;
1112
1213module . exports = {
1314 baseDir : '../' ,
@@ -22,26 +23,14 @@ module.exports = {
2223 * Custom module resolver that maps specifiers for local packages folder.
2324 * This ensures that cross package/entry-point dependencies can be detected.
2425 */
25- const LOCAL_MAPPINGS = [
26- [ '@angular-devkit/build-angular' , 'angular_devkit/build_angular' ] ,
27- [ '@angular-devkit/architect' , 'angular_devkit/architect' ] ,
28- [ '@angular-devkit/architect-cli' , 'angular_devkit/architect_cli' ] ,
29- [ '@angular-devkit/benchmark' , 'angular_devkit/benchmark' ] ,
30- [ '@angular-devkit/build-webpack' , 'angular_devkit/build_webpack' ] ,
31- [ '@angular-devkit/core' , 'angular_devkit/core' ] ,
32- [ '@angular-devkit/schematics' , 'angular_devkit/schematics' ] ,
33- [ '@angular-devkit/schematics-cli' , 'angular_devkit/schematics_cli' ] ,
34- [ '@angular/cli' , 'angular/cli' ] ,
35- [ '@schematics/angular' , 'schematics/angular' ] ,
36- [ '@ngtools/webpack' , 'ngtools/webpack' ] ,
37- ] ;
26+ const LOCAL_MAPPINGS = Object . entries ( packages ) . map ( ( [ name , pkg ] ) => [ name , pkg . root ] ) ;
3827
3928function resolveModule ( specifier ) {
4029 let localSpecifierPath ;
4130
4231 for ( const [ key , value ] of LOCAL_MAPPINGS ) {
4332 if ( specifier . startsWith ( key ) ) {
44- localSpecifierPath = path . join ( __dirname , specifier . replace ( key , value ) ) ;
33+ localSpecifierPath = specifier . replace ( key , value ) ;
4534 break ;
4635 }
4736 }
0 commit comments