Closed antiremy closed 6 years ago
Have the same issue. If I add all of "Can't resolve" to browser part in package.json with false. Compile, however got Jquery not found in Chrome and unable to start application in broswer.
@gitbrent - I forked this project and haver a version of it that works super well with angular-cli and does not generate these errors.
Angular-cli 6 users can go to my updated README to see how to use it with their projects. https://github.com/dgabriel/PptxGenJS
I had to make a number of major changes, so I'm reluctant to issue a pull request. I'm delighted to explore it more if you want figure out how to incorporate in the main project. Here's what I had to change:
Your core project is AWESOME and I'm grateful for all the effort you put into it. This will end up saving me weeks of work.
@mrguodong - don't exclude jQuery, you'll need it (Node users require jsdom
to enable jQuery to work).
@dgabriel - Yeah, excising a large chunk of the code isn't a solution for the project overall.
I'm continuing to work towards an integration method that works easier.
@gitbrent so does this mean we shouldn't expect to get 2.3.0 working in angular?
I wouldn't mind working on a PR, I just don't really know whats causing the issue
It should work in Angular et al.
I'm unsure why there are more now than before... I don't use the library in Angular/React, so i'm not very proficient with integration.
Any and all help from experts in this area is very welcome.
So after a bit of digging, I've narrowed the problem down to the code block inside the last if ( NODEJS )
on line 5216
Regardless of if NODEJS
is true or false, that code is still trying to be compiled by Angular-CLI. It wouldn't be an issue, but the introduction of JSDOM has made it very Node specific. I could successfully get a PowerPoint created if I knocked the code in there down to just
if ( NODEJS ) {
$ = require("jquery");
try { JSZip = require("jszip"); } catch(ex){ console.error("Unable to load `jszip`"); throw 'LIB-MISSING-JSZIP'; }
module.exports = PptxGenJS;
}
@gitbrent I also noticed that Node detection wasn't working well. When I was logging the output of typeof module
and the other checks you use, they were coming back with what you'd expect for Node (module was not undefined and typeof require was a function). I'd suggest just changing the check to typeof window === 'undefined'
@gitbrent Pretty sure I've got a fix, I'll make a PR this weekend
@gitbrent Pretty sure I've got a fix, I'll make a PR this weekend
Definitely waiting on this, we were looking at using an earlier version since 2.3 is impossible to work with. I will check back on this Monday. Thanks.
@Nashid95 PR has been posted, but give this a shot in the meantime https://github.com/antiremy/PptxGenJS
@antiremy This works great, Thank you.
This issue should be resolved now with Issue #415 being checked in.
NOTE: 2.4.0
has been released and includes all code fixes that should address this issue.
Any updated feedback on this? @Nashid95 @antiremy @dgabriel
Have the integration issues been resolved for you guys with the newest release, 2.4.0?
So I updated PptxGenJS to 2.3.0, and actually ended up getting a much longer list of "Module not found: Error: Can't resolve" than I did with 2.2.0. No amount of messing with package.json files seemed to help.
It's worth noting that it's no longer
fs
orpath
, butcrypto
,http
,https
, and a few others. The full log is below