From 4c78c7a78da82096a2b0e27364451100cd1b84c2 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 30 Nov 2021 17:00:31 +0200 Subject: [PATCH] fix for imports --- src/helpers/is-third-party.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/helpers/is-third-party.ts b/src/helpers/is-third-party.ts index 81458e9..4951bba 100644 --- a/src/helpers/is-third-party.ts +++ b/src/helpers/is-third-party.ts @@ -9,12 +9,11 @@ export function isThirdParty(libName: string) { const { thirdPartyDependencies, userLibPrefixes } = getConfig(); try { - isThirdPartyModule = require.resolve(libName).indexOf('/') < 0; + isThirdPartyModule = require.resolve(libName).includes('node_modules'); } catch { console.log(); console.warn(`⚡ You are importing ${libName} but it is not installed.`); console.warn(`⚡ Trying to figure out import category based on library name: ${libName}`); isThirdPartyModule = !libName.startsWith('.') && !userLibPrefixes.some((prefix) => libName.startsWith(prefix)); } - return isThirdPartyModule || breakdownPath(libName).some((subPath) => thirdPartyDependencies.has(subPath)); }