Reputation: 1339
I am trying to use Stripe with my application, when I do, I get this error during build:
ERROR in ./node_modules/stripe/lib/utils.js Module not found: Error: Can't resolve 'child_process' in 'PATH\node _modules\stripe\lib'
When I change my webpack dev config to target node like this:
export default {
...,
target: 'node',
...
}
I get an error with require not being defined, which everywhere online indicates is caused by the following statement which is not in my webpack config:
externals: [nodeExternals()]
As seen in this question.
Upvotes: 4
Views: 3008
Reputation: 127
I guess you're using stripe
from npm
in your frontend application. But this package is a server-side package. You can't integrate it in your client-side code (like React/Angular), you must use it server-side with for example Node.js.
You will find great explanation on how to include stripe on the client side here: https://stripe.com/docs/stripe-js/reference#including-stripejs
Upvotes: 1