We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c63df17 commit 34c0b6bCopy full SHA for 34c0b6b
extensions/index.js
@@ -4,16 +4,12 @@ const path = require('path');
4
const extensions = {};
5
6
fs.readdirSync(__dirname).forEach(moduleDir => {
7
- const extStat = fs.statSync(path.join(__dirname, moduleDir));
8
- if (extStat.isDirectory()) {
9
- let indexStat;
10
- try {
11
- indexStat = fs.statSync(
12
- path.join(__dirname, moduleDir, 'index.js'));
13
- } catch {} // eslint-disable-line no-empty
14
- if (indexStat) {
15
- extensions[moduleDir] = require(`./${moduleDir}`);
16
- }
+ const extPath = path.join(__dirname, moduleDir);
+ const indexPath = path.join(extPath, 'index.js');
+
+ if (fs.statSync(extPath).isDirectory() &&
+ fs.existsSync(indexPath)) {
+ extensions[moduleDir] = require(`./${moduleDir}`);
17
}
18
});
19
0 commit comments