gpt4 book ai didi

Webpack ERROR in node:crypto Module build failed: UnhandledSchemeError: Reading from "node:crypto"(节点中出现webpack错误:加密模块构建失败:未处理架构错误:正在从“节点:加密”中读取)

转载 作者:bug小助手 更新时间:2023-10-25 11:59:40 25 4
gpt4 key购买 nike



I am attempting to update some older code to eliminate warnings. I have upgraded some code that uses the 'crypto' module. However, webpack 5.88.2 does not recognize the new syntax. My new import looks like this:

我正在尝试更新一些较旧的代码以消除警告。我已经升级了一些使用加密模块的代码。然而,webpack 5.88.2没有识别新的语法。我的新导入内容如下所示:


const crypto = await import('node:crypto');

The complete error looks like this. It suggests that I may need another plugin, but I can't find one.

完整的错误如下所示。这表明我可能需要另一个插件,但我找不到一个。


ERROR in node:crypto
Module build failed: UnhandledSchemeError: Reading from "node:crypto" 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.
at C:\xxxxx\functions\auth-check\node_modules\webpack\lib\NormalModule.js:838:25
at Hook.eval [as callAsync] (eval at create (C:\xxxxx\functions\auth-check\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\xxxxx\functions\auth-check\node_modules\tapable\lib\Hook.js:18:14)
at Object.processResource (C:\xxxxx\functions\auth-check\node_modules\webpack\lib\NormalModule.js:835:8)
at processResource (C:\xxxxx\node_modules\loader-runner\lib\LoaderRunner.js:220:11)
at iteratePitchingLoaders (C:\xxxxx\functions\auth-check\node_modules\loader-runner\lib\LoaderRunner.js:171:10)
at runLoaders (C:\xxxxx\node_modules\loader-runner\lib\LoaderRunner.js:398:2)
at NormalModule._doBuild (C:\xxxxx\auth-check\node_modules\webpack\lib\NormalModule.js:825:3)
at NormalModule.build (C:\xxxxx\functions\auth-check\node_modules\webpack\lib\NormalModule.js:969:15)
at C:\xxxxx\functions\auth-check\node_modules\webpack\lib\Compilation.js:1377:12
@ ./src/index.ts 6:21-42

webpack 5.88.2 compiled with 1 error in 2790 ms

更多回答
优秀答案推荐

You should change node:crypto to node/crypto

应将NODE:CRYPTO更改为NODE/CRYPTO


更多回答

Thanks for the answer, but that doesn't work. Typescript can't find the module, and ignoring that, it just gives a different error message in webpack.

谢谢你的回答,但这不管用。TypeScrip找不到模块,忽略这一点,它只会在webpack中给出不同的错误消息。

Did you find a solution to this? Thanks

你找到解决这个问题的办法了吗?谢谢

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com