Skip to content

Commit

Permalink
fix: check for deep import path in import/addNamedModule
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Oct 20, 2023
1 parent 8cc5ddb commit 74ea5b1
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 74ea5b1

Please sign in to comment.