Home Game Development Error: Current surroundings doesn’t present a require() for requiring ‘crypto’ – Cocos Creator

Error: Current surroundings doesn’t present a require() for requiring ‘crypto’ – Cocos Creator

0
Error: Current surroundings doesn’t present a require() for requiring ‘crypto’ – Cocos Creator

[ad_1]

Hello!
I bumped into an issue. I imported the library into the challenge, however I find yourself getting an error once I begin the challenge:

Error: Current surroundings doesn't present a require() for requiring 'crypto'.

I’ve tried many options discovered within the documentation and on third-party websites. But nothing labored. How can I resolve this downside?

As I perceive third celebration packages which I import have require() perform which isn’t supported by present surroundings. But I can’t determine the right way to repair it.

You can seek advice from this doc to make use of crypto:

Thanks for the reply, however this answer didn’t assist.
I’ll attempt to inform you extra in regards to the error.
I’m attempting to import @solana/web3.js into the challenge.

Import * as solanaWeb3 from "@solana/web3.js";

But as quickly as I attempt to use the instance from the documentation:

console.log(solanaWeb3);

An error happens (it’s seen with the developer instruments within the browser):

Error: Current surroundings doesn't present a require() for requiring 'crypto'.
    manufacturing unit cjs-loader.mjs:93
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    _createRequire cjs-loader.mjs:105
    _createRequireWithResolveMap cjs-loader.mjs:112
    execute crypto.js:14
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    _createRequire cjs-loader.mjs:105
    _createRequireWithResolveMap cjs-loader.mjs:112
    execute utils.js:33
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    _createRequire cjs-loader.mjs:105
    _createRequireWithResolveMap cjs-loader.mjs:112
    execute _sha2.js:16
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    _createRequire cjs-loader.mjs:105
    _createRequireWithResolveMap cjs-loader.mjs:112
    execute sha512.js:19
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    _createRequire cjs-loader.mjs:105
    _createRequireWithResolveMap cjs-loader.mjs:112
    execute index.cjs.js:107
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    require cjs-loader.mjs:27
    execute index.cjs.mjs:7
    doExec system.js:482
    postOrderExec system.js:472
    postOrderExec system.js:461
    postOrderExec system.js:459
    postOrderExec system.js:461
    postOrderExec system.js:459
    C system.js:406

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here