import { debug } from './debug' ; export function tryRequire ( name ) { try { const module = { module : require ( name ) , name , path : require . resolve ( name ) , } ; debug ( 'Load successfully: ' , name ) ; return module ; } catch ( err ) { if ( err instanceof Error && err . message . startsWith ( `Cannot find module '${ name }'` ) ) { } else { throw err ; } debug ( "Couldn't load: " , name ) ; } }