You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2020/10/15 19:05:55 UTC

[cordova-fetch] branch master updated: fix: use POSIX-style paths for require.resolve & Co (#90)

This is an automated email from the ASF dual-hosted git repository.

raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-fetch.git


The following commit(s) were added to refs/heads/master by this push:
     new 4868971  fix: use POSIX-style paths for require.resolve & Co (#90)
4868971 is described below

commit 4868971f5ac43fd8b392b635fdb704c0605697d1
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Thu Oct 15 21:05:44 2020 +0200

    fix: use POSIX-style paths for require.resolve & Co (#90)
    
    Although platform-specific paths usually work just fine, this is the way
    it should be (see https://nodejs.org/api/modules.html).
---
 index.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.js b/index.js
index 5a09342..959c4e1 100644
--- a/index.js
+++ b/index.js
@@ -121,7 +121,7 @@ function resolvePathToPackage (name, basedir) {
 
         // We resolve the path to the module's package.json to avoid getting the
         // path to `main` which could be located anywhere in the package
-        return resolve(path.join(name, 'package.json'), { paths, basedir })
+        return resolve(`${name}/package.json`, { paths, basedir })
             .then(([pkgJsonPath, pkgJson]) => [
                 path.dirname(pkgJsonPath), pkgJson
             ]);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org