Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix relative pota command paths on windows #114

Open
ThaNarie opened this issue Mar 4, 2025 · 0 comments
Open

Fix relative pota command paths on windows #114

ThaNarie opened this issue Mar 4, 2025 · 0 comments

Comments

@ThaNarie
Copy link
Member

ThaNarie commented Mar 4, 2025

Today I used patch-package to patch @pota/[email protected] for the project I'm working on.

Relative paths to pota commands were not properly resolved on windows starting with c: instead of file://c/

  "pota": [
    "@pota/muban-webpack-scripts",
    "@pota/plop-scripts",
    "pota.commands.js"
  ]

Here is the diff that solved my problem:

diff --git a/node_modules/@pota/cli/lib/loadCommands.js b/node_modules/@pota/cli/lib/loadCommands.js
index 15fe75a..d6beee2 100644
--- a/node_modules/@pota/cli/lib/loadCommands.js
+++ b/node_modules/@pota/cli/lib/loadCommands.js
@@ -2,7 +2,7 @@ import { pathToFileURL } from 'url';
 import { resolve, isAbsolute, extname } from 'path';
 export function resolveModulePath(path, root) {
     if (extname(path))
-        return isAbsolute(path) ? pathToFileURL(path).toString() : resolve(root, path);
+        return pathToFileURL(isAbsolute(path) ? path : resolve(root, path)).toString();
     // if the path does not have an extension, then assume its a npm package
     return path;
 }

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant