import { findExists } from '@modern-js/utils' ; const FILE_EXTENSIONS = [ '.ts' , '.js' ] ; export const requireModule = ( filename ) => { const exist = findExists ( FILE_EXTENSIONS . map ( ext => `${ filename }${ ext }` ) ) ; if ( ! exist ) { return null ; } const mod = require ( exist ) ; return interopRequire ( mod ) ; } ; function interopRequire ( obj ) { return interopRequireDefault ( obj ) . default ; } function interopRequireDefault ( obj ) { return obj ?. __esModule ? obj : { default : obj } ; }