Skip to content

Commit 4cd67d5

Browse files
committed
fix(build-resources): remove empty path between modules list
1 parent 168c3b5 commit 4cd67d5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/build-resources.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ let moduleNames = [];
2424

2525
function installedLocalModulePaths() {
2626
return execa('npm', ['ls', '--parseable'], { cwd: optionsGlobal.root })
27-
.then(res => res.stdout.split('\n').filter((line, i) => i !== 0))
28-
.catch(res => res.stdout.split('\n').filter((line, i) => i !== 0));
27+
.then(res => res.stdout.split('\n').filter((line, i) => i !== 0 && !!line))
28+
.catch(res => res.stdout.split('\n').filter((line, i) => i !== 0 && !!line));
2929
}
3030

3131
function getFilesRecursively(targetDir, extension) {
@@ -49,7 +49,8 @@ export async function processAll(options) {
4949
debugDetail(`starting resolution: ${options.root}`);
5050

5151
if (modulePaths.length === 0) {
52-
modulePaths = (await installedLocalModulePaths()).map(line => path.normalize(line));
52+
modulePaths = (await installedLocalModulePaths())
53+
.map(line => path.normalize(line));
5354
moduleNames = modulePaths
5455
.map(line => {
5556
const split = line.split('/node_modules/');
@@ -328,7 +329,7 @@ function fixRelativeFromPath(fromPath, realSrcPath, realParentPath, externalModu
328329
} else {
329330
// if starts with './' then relative to the template, else relative to '/src'
330331
if (fromPath.indexOf('.') == 0) {
331-
debugDetail(`fixing relative path: ${fromPath} | relative dir: ${path.relative(realSrcPath, realParentPath)}`)
332+
// debugDetail(`fixing relative path: ${fromPath} | relative dir: ${path.relative(realSrcPath, realParentPath)}`)
332333
fromPath = path.joinSafe('./', path.relative(realSrcPath, realParentPath), fromPath);
333334
}
334335
return externalModule ? path.join(externalModule, fromPath) : fromPath;

0 commit comments

Comments
 (0)