Javascript Amplify JS SDK抛出未捕获的TypeError:无法读取属性';加密';未定义的
AWS SDK抛出Javascript Amplify JS SDK抛出未捕获的TypeError:无法读取属性';加密';未定义的,javascript,reactjs,aws-sdk,aws-cognito,aws-amplify,Javascript,Reactjs,Aws Sdk,Aws Cognito,Aws Amplify,AWS SDK抛出 Uncaught TypeError: Cannot read property 'crypto' of undefined at eval (rng.js:23) at eval (rng.js:32) at Object../node_modules/crypto-browserify/rng.js (main.js:13413) at __webpack_require__ (main.js:20) at eval (index.
Uncaught TypeError: Cannot read property 'crypto' of undefined
at eval (rng.js:23)
at eval (rng.js:32)
at Object../node_modules/crypto-browserify/rng.js (main.js:13413)
at __webpack_require__ (main.js:20)
at eval (index.js:6)
at Object../node_modules/crypto-browserify/index.js (main.js:13389)
at __webpack_require__ (main.js:20)
at eval (AuthenticationHelper.js:9)
at Object../node_modules/amazon-cognito-identity-js/es/AuthenticationHelper.js (main.js:238)
at __webpack_require__ (main.js:20)
我在react应用程序中使用aws amplify作为依赖项
查看现有的类似问题,我发现通过在babel loader的排除列表中添加“node_module”文件夹,问题得到了解决,但在我的情况下,这不起作用
这是网页包配置文件
const HtmlWebPackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.html$/,
use: [
{
loader: "html-loader",
options: {minimize: true}
}
]
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
}]
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
}
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
}),
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css"
})
]
};
你设法解决了这个问题吗?