我无法导入 IPFS,因为一些 Webpack 错误。我真的不知道如何修复它们,但在搜索了一些信息后,我认为这与 Webpack 5 有关。我执行了以下步骤:
npx create-react-app test-app
cd test-app
npm install ipfs
Run Code Online (Sandbox Code Playgroud)
然后我在 App.js 中导入 IPFS:
import Ipfs from 'ipfs';
Run Code Online (Sandbox Code Playgroud)
当我执行时,npm start我收到以下错误:
Module build failed: UnhandledSchemeError: Reading from "node:fs" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
Module build failed: UnhandledSchemeError: Reading from "node:https" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by …Run Code Online (Sandbox Code Playgroud)