Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Webpack imports #3783

Closed
amilich opened this issue Aug 1, 2021 · 4 comments
Closed

Webpack imports #3783

amilich opened this issue Aug 1, 2021 · 4 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@amilich
Copy link

amilich commented Aug 1, 2021

  • Version: 51.0.1
  • Platform:
  • Subsystem:

Severity: Low

Description:

I'm trying to import ipfs-http-client from a React project that uses webpack and seeing:

➤ YN0000: ERROR in ../node_modules/multiaddr/src/ip.js 4:27-59
➤ YN0000: ℹ 「wdm」: Failed to compile.
➤ YN0000: Module not found: Error: Package path ./to-string is not exported from package .../node_modules/uint8arrays (see exports field in .../node_modules/uint8arrays/package.json)
➤ YN0000:  @ ../node_modules/multiaddr/src/convert.js 3:11-26
➤ YN0000:  @ ../node_modules/multiaddr/src/codec.js 3:16-36
➤ YN0000:  @ ../node_modules/multiaddr/src/index.js 3:14-32
➤ YN0000:  @ ../node_modules/ipfs-http-client/src/index.js 5:22-42

Any ideas on webpack config? I saw this issue ipfs-inactive/js-ipfs-http-client#968 but unclear if relevant.

@amilich amilich added the need/triage Needs initial labeling and prioritization label Aug 1, 2021
@welcome
Copy link

welcome bot commented Aug 1, 2021

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@amilich
Copy link
Author

amilich commented Aug 1, 2021

This seems like a possible incompatibility between versions of multiaddr and uint8arrays: Adding the following exports to uint8arrays package.json works:

    "./from-string": {
      "browser": "./esm/src/from-string.js",
      "require": "./cjs/src/from-string.js",
      "import": "./esm/src/from-string.js"
    },
    "./toString": {
      "browser": "./esm/src/to-string.js",
      "require": "./cjs/src/to-string.js",
      "import": "./esm/src/to-string.js"
    },
    "./to-string": {
      "browser": "./esm/src/to-string.js",
      "require": "./cjs/src/to-string.js",
      "import": "./esm/src/to-string.js"
    },

seems possible different resolutions may be needed?

@achingbrain
Copy link
Member

There was an experimental [email protected] release that ported the module to esm with cjs fallback - it got published without a pre-release identifier.

I've just republished 2.1.8 as 2.1.10 so this should be resolved, please delete your node_modules folder and reinstall deps.

@achingbrain
Copy link
Member

Closing as this should be fixed. Please reopen if you are still having problems.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants