File tree Expand file tree Collapse file tree 4 files changed +7
-7
lines changed
Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 11{
22 "compilerOptions" : {
33 "baseUrl" : " ." ,
4- "extends" : " ./59-tsconfig.paths.json" ,
54 "paths" : {
65 "alias/*" : [ " target/*" ]
76 }
8- }
7+ },
8+ "extends" : " ./59-tsconfig.paths.json"
99}
Original file line number Diff line number Diff line change 11{
22 "compilerOptions" : {
3- "baseUrl" : " ." ,
43 "paths" : {
54 "alias-paths/*" : [ " target-paths/*" ]
65 }
Original file line number Diff line number Diff line change 11'use strict' ;
22const path = require ( 'path' )
3- const { configPathsRaw} = require ( '../src' ) ;
3+ const { configPathsRaw, readConfig } = require ( '../src' ) ;
44
55describe ( 'react-app-alias' , ( ) => {
66 test . todo ( 'tested by tests in projects in example folder' ) ;
77} ) ;
88
99describe ( 'extends section of tsconfig on detect config file stage' , ( ) => {
1010 test ( 'read both file and extends' , ( ) => {
11- const paths = configPathsRaw ( path . resolve ( __dirname , './59-tsconfig.json' ) )
11+ const conf = readConfig ( path . resolve ( __dirname , './59-tsconfig.json' ) )
12+ const paths = configPathsRaw ( conf )
1213 expect ( paths [ 'alias/*' ] [ 0 ] ) . toBe ( 'target/*' ) ;
1314 expect ( paths [ 'alias-paths/*' ] [ 0 ] ) . toBe ( 'target-paths/*' ) ;
1415 } ) ;
Original file line number Diff line number Diff line change @@ -152,15 +152,15 @@ function configPathsRaw(conf) {
152152 const confPaths = conf . compilerOptions && conf . compilerOptions . paths ?
153153 conf . compilerOptions . paths : { }
154154
155- const ext = conf . extends
155+ const ext = conf . extends || { }
156156 const extPaths = ext . compilerOptions && ext . compilerOptions . paths ?
157157 ext . compilerOptions . paths : { }
158158
159159 if ( typeof confPaths !== 'object' )
160160 throw Error ( `react-app-alias:configPathsRaw: compilerOptions.paths must be object` )
161161 if ( typeof extPaths !== 'object' )
162162 throw Error ( `react-app-alias:configPathsRaw: compilerOptions.extends->compilerOptions.paths must be object` )
163-
163+
164164 return {
165165 ...confPaths ,
166166 ...extPaths ,
You can’t perform that action at this time.
0 commit comments