You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
286 B

4 years ago
  1. 'use strict';
  2. const resolveFrom = require('resolve-from');
  3. module.exports = (fromDir, moduleId) => require(resolveFrom(fromDir, moduleId));
  4. module.exports.silent = (fromDir, moduleId) => {
  5. try {
  6. return require(resolveFrom(fromDir, moduleId));
  7. } catch (err) {
  8. return null;
  9. }
  10. };