3.0.0 • Published 5 years ago

resolve-cwd v3.0.0

Weekly downloads
17,938,846
License
MIT
Repository
github
Last release
5 years ago

resolve-cwd Build Status

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

Install

$ npm install resolve-cwd

Usage

const resolveCwd = require('resolve-cwd');

console.log(__dirname);
//=> '/Users/sindresorhus/rainbow'

console.log(process.cwd());
//=> '/Users/sindresorhus/unicorn'

console.log(resolveCwd('./foo'));
//=> '/Users/sindresorhus/unicorn/foo.js'

API

resolveCwd(moduleId)

Like require(), throws when the module can't be found.

resolveCwd.silent(moduleId)

Returns undefined instead of throwing when the module can't be found.

moduleId

Type: string

What you would use in require().

Related

  • resolve-from - Resolve the path of a module from a given path
  • import-from - Import a module from a given path
  • import-cwd - Import a module from the current working directory
  • resolve-pkg - Resolve the path of a package regardless of it having an entry point
  • import-lazy - Import a module lazily
  • resolve-global - Resolve the path of a globally installed module

License

MIT © Sindre Sorhus

import-localfree-min@strapi/strapiarchetype-libraryblitz@case-app/case-clicomponennentt@casejs/case-clieasy-select-rnvuedragdropuploadimagesreact-native-bluetooth2killi8n-react-native-fast-image@nujek/clispecify-importsbabel-specify-imports@icanpm/api-masterwebpack-cli-lernahypatia-jschrisereact-native-template-rfbaseairscanairscan-examplereadytest-testcafebb-chatreact-native-esc-pos-sahaab@borisovart/atol-kkt-module@frxf/frxf@lysander6/directusdeneme323112@texttree/demo-bsa-reference-rcl@fundefund/funde_ckslank@ntt_app/react-native-custom-notificationdatoapireact-native-covid-sdkgql_din_mod@zycli/depsbitget@thinkdeep/deep-graphql-binding@l1nyanm1ng/react-picture-viewer@dacio/graphql-bindingcthpb-plugin-socialdirectus9-lite@olivervorasai/sliderreact-native-printer-brotherscbmis-ai-toolboxreact-native-shekhar-bridge-test@ezziepos-commerce/ezziepos-clicogoportutilslevibestliblevibestlib2levilibtest19levilibtest24levilibtest25levilibtest26levilibtest27levilibtest28levilibtest29module-federation-webpack-pluginwilscanner@oiti/documentoscopy-react-nativejs4cytoscape@mink-opn/build-tokensquoc-testreact-native-slider-kfunblock-block-save-variablescclibyarntesthyperpass-sdkplginexpand-react-bridgeluminos-ui-coretestcafegatsby-clisklif-ui-kitsklif-api@everything-registry/sub-chunk-2657jawwy-sdkjawwy_gamification_release@314oner_npm/universal-components-libraryreact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgp149-tablesklif-uireact-native-jawwy_samplenuxt-content-body-htmloracle-zkappparallax-horizontal-scroll-2painlessp147-tablep148-tablenpm_qwertynpx_demo_blankansernpm_one_12_34_1_npm_one_1_2_3npm_one_2_2ns-dropdown-menunumhandlernumericalts
3.0.0

5 years ago

2.0.0

7 years ago

1.0.0

8 years ago