From 83379a2f5b8fe680a748d8ce269ea2a037b31cc4 Mon Sep 17 00:00:00 2001 From: Andrew Lisowski Date: Thu, 21 Mar 2019 17:25:07 -0700 Subject: [PATCH] if we are int a local file use the package.json for version information --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 0aecbc4..dfc7b95 100644 --- a/lib/index.js +++ b/lib/index.js @@ -44,7 +44,7 @@ const ensureCachePath = co.wrap(function*() { module.exports = co.wrap(function*(name, opts = {}) { const outDir = yield ensureCachePath() - const parsed = name.split(',').map(parse) + let parsed = name.split(',').map(parse) // When you run `package-size ./dist/index.js,react` // Or `package-size react-dom,react --cwd` @@ -240,7 +240,7 @@ module.exports = co.wrap(function*(name, opts = {}) { versionedName: parsed .map( pkg => - `${pkg.name}${pkg.path ? `/${pkg.path}` : ''}@${packageInfo[pkg.name].version}` + `${pkg.name}${pkg.path ? `/${pkg.path}` : ''}${packageInfo[pkg.name] ? `@${packageInfo[pkg.name].version}` : ''}` ) .join(','), size: asset.size - 2753, // minus webpack runtime size