File tree 2 files changed +9
-5
lines changed
packages/@ngtools/webpack/src
tests/e2e/assets/webpack/test-app
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -113,13 +113,16 @@ export class AotPlugin implements Tapable {
113
113
basePath = path . resolve ( process . cwd ( ) , options . basePath ) ;
114
114
}
115
115
116
- let tsConfigJson : any = null ;
117
- try {
118
- tsConfigJson = JSON . parse ( ts . sys . readFile ( this . _tsConfigPath ) ) ;
119
- } catch ( err ) {
120
- throw new Error ( `An error happened while parsing ${ this . _tsConfigPath } JSON: ${ err } .` ) ;
116
+ const configResult = ts . readConfigFile ( this . _tsConfigPath , ts . sys . readFile ) ;
117
+ if ( configResult . error ) {
118
+ const diagnostic = configResult . error ;
119
+ const { line, character} = diagnostic . file . getLineAndCharacterOfPosition ( diagnostic . start ) ;
120
+ const message = ts . flattenDiagnosticMessageText ( diagnostic . messageText , '\n' ) ;
121
+ throw new Error ( `${ diagnostic . file . fileName } (${ line + 1 } ,${ character + 1 } ): ${ message } )` ) ;
121
122
}
122
123
124
+ const tsConfigJson = configResult . config ;
125
+
123
126
if ( options . hasOwnProperty ( 'compilerOptions' ) ) {
124
127
tsConfigJson . compilerOptions = Object . assign ( { } ,
125
128
tsConfigJson . compilerOptions ,
Original file line number Diff line number Diff line change 1
1
{
2
+ // Test comment
2
3
"compilerOptions" : {
3
4
"baseUrl" : " " ,
4
5
"module" : " es2015" ,
You can’t perform that action at this time.
0 commit comments