ipfs-shipyard / is-ipfs

A set of utilities to help identify IPFS resources on the web
https://www.npmjs.com/package/is-ipfs
Other
126 stars 22 forks source link

Package path . is not exported from package #66

Open junior-stack opened 1 year ago

junior-stack commented 1 year ago

Hello, I am trying to develop a package based on is-ipfs. The package version is 7.0.3. I called the peerMultiaddr from the is-ipfs in the following way in typescript:

import { peerMultiaddr } from 'is-ipfs';
export const validate = (nodes: any[]) => {
    nodes.forEach((node) => {
    if (!peerMultiaddr(node)) {
      throw new Error(
        `Incorrect`,
      );
    }
  });
} 

Then I compiled it and tested the compiled package in a nextjs application using yarn link. I got the error of:

Module not found: Package path . is not exported from package<Path>\node_modules\is-ipfs (see exports field in <Path>\node_modules\is-ipfs\package.json)
  2 | Object.defineProperty(exports, "__esModule", { value: true });

I don't receive this error if I downgrade the package version to 0.6.0, but it's really a big downgrade

hmmdeif commented 7 months ago

Correct, this is an issue for a TS project using the latest release. I had to go down to 6.0.2. Would be cool if the export could be correctly defined.