After inserting the script tag for Stripe.js
into my index.html
:
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
Webpack is throwing an error message:
Module not found: Error: Can't resolve 'stripe'
The issue seems to be that webpack
cannot locate the 'stripe'
module. I am importing it using:
import 'stripe';
In my code, I am utilizing the Stripe
keyword to access the Stripe
functionality:
@Injectable()
export class SourceEffects {
constructor() {
Stripe.setPublishableKey("pk_test_Casd");
}
}
Even though everything appears fine (VSCODE
doesn't show any warnings), webpack throws the mentioned error during the build process.
Any suggestions?
EDIT
To summarize:
- I am using
@types/stripe
. - I am importing it in typescript using
import 'stripe'
. - Webpack is raising a
can't resolve stripe module
error.