diff --git a/packages/core/src/generators/imports.ts b/packages/core/src/generators/imports.ts index e5b4be0c7..9bb361ea4 100644 --- a/packages/core/src/generators/imports.ts +++ b/packages/core/src/generators/imports.ts @@ -181,9 +181,12 @@ export const addDependency = ({ hasSchemaDir: boolean; isAllowSyntheticDefaultImports: boolean; }) => { - const toAdds = exports.filter((e) => - implementation.includes(e.alias || e.name), - ); + const toAdds = exports.filter((e) => { + const searchWords = [e.alias, e.name].filter((p) => p?.length).join('|'); + const pattern = new RegExp(`\\b(${searchWords})\\b`, 'g'); + + return implementation.match(pattern); + }); if (!toAdds.length) { return undefined;