diff --git a/packages/js/src/utils/inline.ts b/packages/js/src/utils/inline.ts index a3820bd2e56f7..7508ee5cbe65e 100644 --- a/packages/js/src/utils/inline.ts +++ b/packages/js/src/utils/inline.ts @@ -309,7 +309,8 @@ function recursiveUpdateImport( const updatedContent = fileContent.replace(importRegex, (matched) => { const result = matched.replace(/['"]/g, ''); // If a match is the same as the rootParentDir, we're checking its own files so we return the matched as in no changes. - if (result === rootParentDir) return matched; + if (result === rootParentDir || !inlinedDepsDestOutputRecord[result]) + return matched; const importPath = `"${relative( dirPath, inlinedDepsDestOutputRecord[result]