hexo/node_modules/hexo-theme-fluid/scripts/utils/resolve.js

16 lines
292 B
JavaScript
Raw Normal View History

2023-10-03 11:14:36 +08:00
'use strict';
const path = require('path');
const resolveModule = (name, file = '') => {
let dir;
try {
dir = path.dirname(require.resolve(`${name}/package.json`));
} catch (error) {
return '';
}
return `${dir}/${file}`;
};
module.exports = resolveModule;