From 85aa577b6fee8a951fa0b5cb80257c2fd0c8903a Mon Sep 17 00:00:00 2001 From: Maxence LEFEBVRE Date: Mon, 25 Mar 2024 16:03:12 +0100 Subject: [PATCH] fix(core): cannot read property kind of undefined (#21715) --- .../move/lib/__snapshots__/update-imports.spec.ts.snap | 2 ++ .../workspace/src/generators/move/lib/update-imports.spec.ts | 2 ++ packages/workspace/src/generators/move/lib/update-imports.ts | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/workspace/src/generators/move/lib/__snapshots__/update-imports.spec.ts.snap b/packages/workspace/src/generators/move/lib/__snapshots__/update-imports.spec.ts.snap index f86cf34f154fa..04d3f3224b0ff 100644 --- a/packages/workspace/src/generators/move/lib/__snapshots__/update-imports.spec.ts.snap +++ b/packages/workspace/src/generators/move/lib/__snapshots__/update-imports.spec.ts.snap @@ -32,6 +32,8 @@ exports[`updateImports should update dynamic imports 1`] = ` exports[`updateImports should update imports and reexports 1`] = ` " import { MyClass } from '@proj/my-destination'; + + export { MyClass }; export { MyOtherClass } from '@proj/my-destination'; export class MyExtendedClass extends MyClass {}; diff --git a/packages/workspace/src/generators/move/lib/update-imports.spec.ts b/packages/workspace/src/generators/move/lib/update-imports.spec.ts index 51cc0b614a999..ef5291c5efd11 100644 --- a/packages/workspace/src/generators/move/lib/update-imports.spec.ts +++ b/packages/workspace/src/generators/move/lib/update-imports.spec.ts @@ -238,6 +238,8 @@ describe('updateImports', () => { importerFilePath, ` import { MyClass } from '@proj/my-source'; + + export { MyClass }; export { MyOtherClass } from '@proj/my-source'; export class MyExtendedClass extends MyClass {}; diff --git a/packages/workspace/src/generators/move/lib/update-imports.ts b/packages/workspace/src/generators/move/lib/update-imports.ts index 55eb22d047e57..e5c3df0f3d9f0 100644 --- a/packages/workspace/src/generators/move/lib/update-imports.ts +++ b/packages/workspace/src/generators/move/lib/update-imports.ts @@ -195,7 +195,7 @@ function updateImportDeclarations( const changes: StringChange[] = []; for (const { moduleSpecifier } of importDecls) { - if (tsModule.isStringLiteral(moduleSpecifier)) { + if (moduleSpecifier && tsModule.isStringLiteral(moduleSpecifier)) { changes.push(...updateModuleSpecifier(moduleSpecifier, from, to)); } }