We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 31dbd78 commit 4fa046dCopy full SHA for 4fa046d
src/get-entry-point.js
@@ -1,14 +1,18 @@
1
const fs = require('fs');
2
3
function readPackageJSON() {
4
- return JSON.parse(fs.readFileSync('./package.json'));
+ return JSON.parse(fs.readFileSync('./package.json'));
5
}
6
7
function getEntryPoint() {
8
- const pkgJSON = readPackageJSON();
9
- return pkgJSON.main || './index.js';
+ const pkgJSON = readPackageJSON();
+ let entry = pkgJSON.main || 'index.js';
10
+ if (entry[0] !== '.' && entry[0] !== '/' && entry[0] !== '\\') {
11
+ entry = './' + entry;
12
+ }
13
+ return entry;
14
15
16
module.exports = {
- getEntryPoint,
-};
17
+ getEntryPoint
18
+};
0 commit comments