File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/cli/src/scripts/codemod/transforms/export-maps Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ export default function transform(file: FileInfo, api: API): string | undefined
3939 if ( spec . type !== 'ImportSpecifier' ) return ;
4040
4141 const importedName = spec . imported . name as string ;
42- const localName = spec . local ? spec . local . name : importedName ;
4342
4443 // target component
4544 let componentName = importedName ;
@@ -60,8 +59,12 @@ export default function transform(file: FileInfo, api: API): string | undefined
6059 : `${ packageName } /${ importedName } ` ; // regular component
6160
6261 const newImport = j . importDeclaration (
63- //todo: as string
64- [ j . importSpecifier ( j . identifier ( importedName ) , j . identifier ( localName as string ) ) ] ,
62+ [
63+ j . importSpecifier (
64+ j . identifier ( importedName ) ,
65+ j . identifier ( spec . local && typeof spec . local . name === 'string' ? spec . local . name : importedName ) ,
66+ ) ,
67+ ] ,
6568 j . literal ( newSource ) ,
6669 ) ;
6770
You can’t perform that action at this time.
0 commit comments