Skip to content

Commit

Permalink
refactor: code
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Feb 27, 2024
1 parent c53553c commit bf7b68f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/ResolverFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

"use strict";

const findPnpApi = require("module").findPnpApi;
const versions = require("process").versions;
const Resolver = require("./Resolver");
const { getType, PathType } = require("./util/path");
Expand Down Expand Up @@ -126,13 +125,18 @@ function processPnpApiOption(option) {
option === undefined &&
/** @type {NodeJS.ProcessVersions & {pnp: string}} */ versions.pnp
) {
const _findPnpApi = /** @type {function(string): PnpApi | null}} */ (
findPnpApi
);
const _findPnpApi =
/** @type {function(string): PnpApi | null}} */
(
// @ts-ignore
require("module").findPnpApi
);

if (_findPnpApi) {
return {
resolveToUnqualified(request, issuer, opts) {
const pnpapi = _findPnpApi(issuer);

if (!pnpapi) {
// Issuer isn't managed by PnP
return null;
Expand Down

0 comments on commit bf7b68f

Please sign in to comment.