我已经在我的 React 演示项目中使用 Stripe 实现了收款,并且我正在使用 Express Js 作为后端。
现在,我正尝试将该演示项目代码合并到我的实际项目中,但它在运行时显示错误,如下所示:
CheckoutForm.js?8185:16 Uncaught ReferenceError:
regeneratorRuntime is not defined
所以我用谷歌搜索了这个错误并在我的 package.json 文件中添加了以下依赖项,但我仍然面临上述错误。
"babel-core": "^6.26.3",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1
下面是我的 .babelrc 文件代码。
{
"stage" : 0,
"env": {
"development": {
"plugins" : ["react-transform"],
"extra": {
"react-transform": [{
"target" : "react-transform-hmr",
"imports" : ["react"],
"locals" : ["module"]
}, {
"target" : "react-transform-catch-errors",
"imports" : ["react", "redbox-react"]
}]
}
},
"production": {
}
}
}
谁有这个问题的引用链接或解决方案?
最佳答案
实际上我昨天在另一个图书馆遇到了这个问题。对我有用的是做你上面所做的,但也在我的应用程序的主要入口点组件中导入 polyfill:
import 'babel-polyfill';
这可能是您所缺少的。
关于javascript - 在 React js 中集成 Stripe 支付,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51821967/