UNPKG

881 BJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6var import_cwd_1 = __importDefault(require("import-cwd"));
7function tryRequire(tryPath) {
8 try {
9 // Require from CWD
10 return import_cwd_1.default(tryPath);
11 }
12 catch (error) {
13 // if we try to actually require npm we will import something that is the actual npm API
14 // not the plugin that we want
15 if (tryPath === 'npm') {
16 return;
17 }
18 try {
19 // Require from __dirname. Needed for npx and global installs
20 return require(tryPath);
21 }
22 catch (error) {
23 return;
24 }
25 }
26}
27exports.default = tryRequire;
28//# sourceMappingURL=try-require.js.map
\No newline at end of file