Skip to content

Commit 7680333

Browse files
author
giautm
committed
Fix issues #4
1 parent 8991fa4 commit 7680333

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/get-entry-point.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const fs = require('fs');
2+
3+
function readPackageJSON() {
4+
return JSON.parse(fs.readFileSync('./package.json'));
5+
}
6+
7+
function getEntryPoint() {
8+
const pkgJSON = readPackageJSON();
9+
return pkgJSON.main || './index.js';
10+
}
11+
12+
module.exports = {
13+
getEntryPoint,
14+
};

src/webpack.haul.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
const Visualizer = require('webpack-visualizer-plugin');
2+
const { getEntryPoint } = require('./get-entry-point');
3+
4+
const entry = getEntryPoint();
25

36
module.exports = ({platform}, {module, plugins}) => {
47
return {
5-
entry: `./index.js`,
8+
entry,
69
module: Object.assign(
710
{},
811
module,

0 commit comments

Comments
 (0)