@@ -81,7 +81,7 @@ export abstract class AngularWebpack {
81
81
/**
82
82
* Add the list of files to include into the typescript compilation as absolute paths
83
83
*/
84
- private generateTsConfig ( appPath : string , includePaths : string [ ] ) : string {
84
+ private generateTsConfig ( appPath : string , includePaths : string [ ] , excludePaths : string [ ] ) : string {
85
85
const tsconfigPath = join ( appPath , 'tsconfig.app.json' ) ;
86
86
const tsconfigJSON = readConfigFile ( tsconfigPath , sys . readFile ) ;
87
87
const pAppPath = pathNormalizeToLinux ( appPath ) ;
@@ -94,6 +94,7 @@ export abstract class AngularWebpack {
94
94
] ;
95
95
tsconfigJSON . config . exclude = [
96
96
posix . join ( pAppPath , '**/*.spec.ts' ) ,
97
+ ...excludePaths ,
97
98
...includePaths . map ( ( path ) => posix . join ( path , '**/*.spec.ts' ) ) ,
98
99
] ;
99
100
@@ -108,7 +109,8 @@ export abstract class AngularWebpack {
108
109
* write a link to load custom modules dynamically.
109
110
*/
110
111
writeTsconfig ( context : DevServerContext | BundlerContext , rootSpace : string ) : string {
111
- const componentsFilePaths = new Set < string > ( ) ;
112
+ const includePaths = new Set < string > ( ) ;
113
+ const excludePaths = new Set < string > ( ) ;
112
114
const dirPath = join ( this . tempFolder , context . id ) ;
113
115
if ( ! existsSync ( dirPath ) ) {
114
116
mkdirSync ( dirPath , { recursive : true } ) ;
@@ -124,15 +126,17 @@ export abstract class AngularWebpack {
124
126
if ( ! capsule ) {
125
127
throw new Error ( `No capsule found for ${ component . id } in network graph` ) ;
126
128
}
127
- outputPath = join ( capsule . path , 'src' ) ;
129
+ outputPath = capsule . path ;
128
130
} else {
129
- outputPath = join ( this . workspace ?. getComponentPackagePath ( component ) || '' , 'src' ) ;
131
+ outputPath = this . workspace ?. getComponentPackagePath ( component ) || '' ;
130
132
}
131
133
132
- componentsFilePaths . add ( pathNormalizeToLinux ( outputPath ) ) ;
134
+ includePaths . add ( pathNormalizeToLinux ( outputPath ) ) ;
135
+ excludePaths . add ( pathNormalizeToLinux ( join ( outputPath , 'dist' ) ) ) ;
136
+ excludePaths . add ( pathNormalizeToLinux ( join ( outputPath , '_src' ) ) ) ;
133
137
} ) ;
134
138
135
- const content = this . generateTsConfig ( rootSpace , Array . from ( componentsFilePaths ) ) ;
139
+ const content = this . generateTsConfig ( rootSpace , Array . from ( includePaths ) , Array . from ( excludePaths ) ) ;
136
140
const hash = objectHash ( content ) ;
137
141
const targetPath = join ( dirPath , `__tsconfig-${ this . timestamp } .json` ) ;
138
142
0 commit comments