我在 angular 11 中使用 crypto-js,但是当我更新 webpack 时出现了这个烦人的警告,我不知道如何以及在哪里(路径)我可以解决它!错误是:
./node_modules/crypto-js/core.js:43:22-39 - Warning: Module not found: Error: Can't resolve 'crypto' in 'D:\node_modules\crypto-js'
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 }
Warning: D:\cryptoJs.service.ts depends on 'crypto-js'. CommonJS or AMD dependencies can cause optimization bailouts.
我什至安装了 crypto-browserify 但还没有解决。如何处理?