use-shopping-cart
use-shopping-cart copied to clipboard
Webpack 5 polyfill configuration issue
Module not found: Error: Can't resolve 'crypto' with Webpack
Hi @Nauman1971, could you provide some more information about this error you're getting and what setup you're using?
Specifically, can you say what version of use-shopping-cart you're using?
If you are using Webpack5 one way to fix it could be to add this on your Webpack config file:
resolve: { fallback: { crypto: false }, },
That's how I solved it.
Webpack also tells you which options you have:
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
Thank you for your reply. Yes i also solved this problem with the solution you provided
On Mon, 5 Jul 2021, 23:09 Xavier Martínez Pujol, @.***> wrote:
If you are using Webpack5 one way to fix it could be to add this on your Webpack config file:
resolve: { fallback: { crypto: false }, },
That's how I solved it.
Webpack also tells you which options you have:
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dayhaysoos/use-shopping-cart/issues/214#issuecomment-874265673, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIMITOVQP667WMVTOJ7B76LTWHYL7ANCNFSM472P4OAQ .