From ac0c6719a3c809913d540e9ff5a55bff69c5b44e Mon Sep 17 00:00:00 2001 From: Tommy Date: Sat, 4 Feb 2017 21:26:57 -0500 Subject: [PATCH] fix: Remove unnecessary trailing /index in the local path resolution (#117) --- src/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.js b/src/utils.js index c55e999..32cca06 100644 --- a/src/utils.js +++ b/src/utils.js @@ -5,9 +5,9 @@ export function toPosixPath(modulePath) { } export function toLocalPath(p) { - return (p[0] !== '.') - ? `./${p}` - : p; + return p + .replace(/\/index$/, '') // remove trailing /index + .replace(/^(?!\.)/, './'); // insert `./` to make it a local path } export function replaceExtension(p, ext) {