RapiPdf
RapiPdf copied to clipboard
Usage in React
Hi! I am trying to use rapipdf in my react app, but I have a problem with it. So, I installed this package using: npm i rapipdf and then I import it in my app like it is presented in RapiDoc examples :
import 'rapipdf';
...
class MyComponent extends React.Component<MyProps, MyState> {
...
render() {
return (<rapi-pdf
spec-url={'/apis/api.yml'}
button-bg="#b44646"
>
</rapi-pdf>);
}
Unfortunately, within the compilation, I have an error:
ERROR in ./node_modules/rapipdf/src/rapipdf.js
Module not found: Error: Can't resolve '@/pdf-gen' in '/home/me/project/node_modules/rapipdf/src'
@ ./node_modules/rapipdf/src/rapipdf.js 35:0-34 240:6-15
@ ./src/MyComponent.tsx
Could you help me fix it? And how can I use rapipdf in js applications without downloading and including rapipdf-min.js in html?
I was able to work around this issue by using import 'rapipdf/dist/rapipdf-min.js'; instead.
@tannerntannern How to call generatePdf?