Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage in React #64

Open
rowbotman opened this issue Jul 2, 2020 · 2 comments
Open

Usage in React #64

rowbotman opened this issue Jul 2, 2020 · 2 comments

Comments

@rowbotman
Copy link

rowbotman commented Jul 2, 2020

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?

@tannerntannern
Copy link

I was able to work around this issue by using import 'rapipdf/dist/rapipdf-min.js'; instead.

@syksy-map
Copy link

@tannerntannern How to call generatePdf?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants