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 1
1
{
2
2
"compilerOptions" : {
3
3
"baseUrl" : " ." ,
4
- "extends" : " ./59-tsconfig.paths.json" ,
5
4
"paths" : {
6
5
"alias/*" : [ " target/*" ]
7
6
}
8
- }
7
+ },
8
+ "extends" : " ./59-tsconfig.paths.json"
9
9
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"compilerOptions" : {
3
- "baseUrl" : " ." ,
4
3
"paths" : {
5
4
"alias-paths/*" : [ " target-paths/*" ]
6
5
}
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
const path = require ( 'path' )
3
- const { configPathsRaw} = require ( '../src' ) ;
3
+ const { configPathsRaw, readConfig } = require ( '../src' ) ;
4
4
5
5
describe ( 'react-app-alias' , ( ) => {
6
6
test . todo ( 'tested by tests in projects in example folder' ) ;
7
7
} ) ;
8
8
9
9
describe ( 'extends section of tsconfig on detect config file stage' , ( ) => {
10
10
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 )
12
13
expect ( paths [ 'alias/*' ] [ 0 ] ) . toBe ( 'target/*' ) ;
13
14
expect ( paths [ 'alias-paths/*' ] [ 0 ] ) . toBe ( 'target-paths/*' ) ;
14
15
} ) ;
Original file line number Diff line number Diff line change @@ -152,15 +152,15 @@ function configPathsRaw(conf) {
152
152
const confPaths = conf . compilerOptions && conf . compilerOptions . paths ?
153
153
conf . compilerOptions . paths : { }
154
154
155
- const ext = conf . extends
155
+ const ext = conf . extends || { }
156
156
const extPaths = ext . compilerOptions && ext . compilerOptions . paths ?
157
157
ext . compilerOptions . paths : { }
158
158
159
159
if ( typeof confPaths !== 'object' )
160
160
throw Error ( `react-app-alias:configPathsRaw: compilerOptions.paths must be object` )
161
161
if ( typeof extPaths !== 'object' )
162
162
throw Error ( `react-app-alias:configPathsRaw: compilerOptions.extends->compilerOptions.paths must be object` )
163
-
163
+
164
164
return {
165
165
...confPaths ,
166
166
...extPaths ,
You can’t perform that action at this time.
0 commit comments