fix: Make importing styles not break the builds (#7550)

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen authored and GitHub committed 2023-04-14 09:06:58 +03:00
1 parent 1e0cb9fc14
commit 2debe61359
1 file changed
+9 -6
@@ -16,14 +16,17 @@ class ProtectFromImportingNonDependencies {
const isDependencyOfDependency =
toBeResolved.context.includes("node_modules");
if (!isLocalDependency && !isDependencyOfDependency) {
const dependencyName = getDependencyName(toBeResolved.request);
nodeModulesToBeResolved.add(dependencyName);
}
});
});
const dependencyWeAreInterested =
!isLocalDependency && !isDependencyOfDependency && dependencyName;
if (dependencyWeAreInterested) {
nodeModulesToBeResolved.add(dependencyName);
}
});
}
);
compiler.hooks.afterCompile.tap("compile", () => {
const notSpecifiedDependencies = [...nodeModulesToBeResolved].filter(