Message Boards

Why Liferay don't recognize jspdf

Andres Toro, modified 3 Years ago.

Why Liferay don't recognize jspdf

New Member Posts: 4 Join Date: 11/25/20 Recent Posts

I'm trying to deploy my aplication React in Liferay, but when is added like widget nothing happens.

Neither happens errors, but if I run the aplication with npm start, it works correctly

 

thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Why Liferay don't recognize jspdf

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts

Is the javascript with the react app even loaded? Did you check in the browser developer tools? Do you see any errors in the browser console?

What is your project setup? How did you create it? Did you use the generator?

https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-generator-liferay-js

Or did you use liferay-js:adapt to package your widget?

https://help.liferay.com/hc/en-us/articles/360035467712-Adapting-Existing-Apps-to-Run-on-Liferay-DXP

 

Andres Toro, modified 3 Years ago.

RE: RE: Why Liferay don't recognize jspdf

New Member Posts: 4 Join Date: 11/25/20 Recent Posts

Hi Christoph Rabel for you answer.

I used liferay-js:adapt for my project

I don't see any error in the browser console

Is the javascript with the react app even loaded? -> How can I verify that?

Andres Toro, modified 3 Years ago.

RE: Why Liferay don't recognize jspdf

New Member Posts: 4 Join Date: 11/25/20 Recent Posts

Hi Christoph Rabel for you answer.

I used liferay-js:adapt for my project

I don't see any error in the browser console

Is the javascript with the react app even loaded? -> How can I verify that?

thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Why Liferay don't recognize jspdf

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts

You could try to check in the network tab. Search for "my-app" (or whatever your module is called). You should see some requests like these:

http://localhost:8080/o/js_resolve_modules?modules=my-app@0.1.0

http://localhost:8080/combo/?.../o/js/resolved-module/my-app@0.1.0/static/js/runtime-main.js&/o/js/resolved-module/my-app@0.1.0/static/js/2.chunk.js&/o/js/resolved-module/my-app@0.1.0/static/js/main.chunk.js&/o/js/resolved-module/my-app@0.1.0/adapt-rt.js&/o/js/resolved-module/my-app@0.1.0/index.js

In general, it is really hard to tell why it does not work for you. It works for me.

Did you change anything on the page or try start from scratch? Create react app, adapt, deploy? Which Liferay version do you use?

Andres Toro, modified 3 Years ago.

RE: RE: Why Liferay don't recognize jspdf

New Member Posts: 4 Join Date: 11/25/20 Recent Posts

Yes, I see this:

 

But if I created the app ("my-app3) whit the liferay generator, the error is the next:

 

 

 

 

thumbnail
Christoph Rabel, modified 3 Years ago.

RE: RE: Why Liferay don't recognize jspdf

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts

Ok, replying to myself since I can't reply to Andres Toros post.

I tried it now myself with jsPDF and adapt. I see the problem. The js-adapt code assumes that there will be only two chunks. It loads main.chunk and 2.chunk.

BUT when you add jsPDF, you get six chunks and the chunk files 3-6 are not requested in the combo call. -> Can't work.

I actually have no idea how to fix this. You could try to ask on github, maybe they can tell you what you could do:

https://github.com/liferay/liferay-js-toolkit