diff --git a/src/transforms/v2-to-v3/modules/importModule/addNamedModule.ts b/src/transforms/v2-to-v3/modules/importModule/addNamedModule.ts index ca29d333f..7d021bea5 100644 --- a/src/transforms/v2-to-v3/modules/importModule/addNamedModule.ts +++ b/src/transforms/v2-to-v3/modules/importModule/addNamedModule.ts @@ -113,9 +113,10 @@ export const addNamedModule = ( j.stringLiteral(packageName) ); - const v2importDeclarations = source - .find(j.ImportDeclaration) - .filter((path) => path.node.source.value === PACKAGE_NAME); + const v2importDeclarations = source.find(j.ImportDeclaration).filter((path) => { + const { value } = path.node.source; + return typeof value === "string" && value.startsWith(PACKAGE_NAME); + }); if (v2importDeclarations.size()) { // Insert it after the last import declaration.