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

Resolve the path of a module like require.resolve() but from the current working directory? #5

Open
mqliutie opened this issue Oct 9, 2019 · 0 comments

Comments

@mqliutie
Copy link

mqliutie commented Oct 9, 2019

What means of current working directory.
In my project

learnNode
  └─ node_modules
  └─ webpack-cli
      └─ bin
        └─ cli.js
const resolveCwd = require('resolve-cwd');
const filePath = 'webpack-cli/bin/cli.js';
const localFile = resolveCwd.silent(filePath);
console.log(process.cwd())
console.log(localFile) 

process.cwd() print is /Users/tt/Study/leanrNode
localFile print is /Users/tt/Study/leanrNode/node_modules/webpack-cli/bin/cli.js

Resolve the path of a module like require.resolve() but from the current working directory

Should current working directory be 'leanrNode'?

Expected localFile print /Users/tt/Study/leanrNode/webpack-cli/bin/cli.js?

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