在 React js 中集成 Stripe 支付



我已经在我的演示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';

这可能就是你错过的。

最新更新