Skip to content

Commit 4fa046d

Browse files
committed
Fixed entry point not found for expo projects
1 parent 31dbd78 commit 4fa046d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/get-entry-point.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
const fs = require('fs');
22

33
function readPackageJSON() {
4-
return JSON.parse(fs.readFileSync('./package.json'));
4+
return JSON.parse(fs.readFileSync('./package.json'));
55
}
66

77
function getEntryPoint() {
8-
const pkgJSON = readPackageJSON();
9-
return pkgJSON.main || './index.js';
8+
const pkgJSON = readPackageJSON();
9+
let entry = pkgJSON.main || 'index.js';
10+
if (entry[0] !== '.' && entry[0] !== '/' && entry[0] !== '\\') {
11+
entry = './' + entry;
12+
}
13+
return entry;
1014
}
1115

1216
module.exports = {
13-
getEntryPoint,
14-
};
17+
getEntryPoint
18+
};

0 commit comments

Comments
 (0)