import * as upath from 'upath' ; export function resolveFrom ( packageName , dir ) { try { const modulePath = upath . toUnix ( require . resolve ( packageName , { paths : [ dir ] } ) ) ; if ( modulePath . startsWith ( dir ) === false ) { return undefined ; } return modulePath ; } catch ( error ) { console . log ( error ) ; return undefined ; } }