File tree Expand file tree Collapse file tree
operation-location-migration-e2e/src/test-apollo-support/components
operation-location-migration/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @eddeee888/gcg-operation-location-migration ' : patch
3+ ---
4+
5+ Fix an issue where dynamic import function does not have an identifier and will cause runtime error
Original file line number Diff line number Diff line change 1+ // This file is not supposed to have any component or graphql docs
2+ // This is testing that codemod can handle files with dynamic imports
3+ import ( 'node:console' ) . then ( ) ;
Original file line number Diff line number Diff line change @@ -221,8 +221,13 @@ export const preset: Types.OutputPreset<TypedPresetConfig> = {
221221 . getDescendantsOfKind ( SyntaxKind . CallExpression )
222222 . forEach ( ( callExpression ) => {
223223 const calledFunctionName = callExpression
224- . getFirstDescendantByKindOrThrow ( SyntaxKind . Identifier )
225- . getText ( ) ;
224+ . getFirstDescendantByKind ( SyntaxKind . Identifier )
225+ ?. getText ( ) ;
226+
227+ if ( ! calledFunctionName ) {
228+ return ;
229+ }
230+
226231 if (
227232 hooksToReplace [ calledFunctionName ] &&
228233 fileMetadata . functionsToReplace [ calledFunctionName ]
You can’t perform that action at this time.
0 commit comments