-
Notifications
You must be signed in to change notification settings - Fork 652
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
Errors when using webpack/Typescript #72
Comments
Hi @Vivihung , Thanks for reporting this. The callback issue affects Node.js as well as webpack. Please try your build again with the newest codebase and let me know how it goes. |
Thanks for the quick fix! |
Hi @Vivihung , Version 1.4.0 has been released to NPM. Please let me know if you have any further issues. |
Hi @gitbrent , |
Hi @HoangLong93 What version of PptxgenJS are you using? PptxGenJS = require("pptxgenjs");
var pptx = new PptxGenJS();
console.log(pptx.version); |
Have the same issue as @HoangLong93 Mistakes:
Will be great, if it is a work around. |
Hi @gitbrent , Thanks |
Okay, thanks for checking. Version 2.2.0 has the newest Node-detection code that fixes these unresolved libraries. It'll be released this weekend... |
Hi @gitbrent , ERROR in ./node_modules/image-size/lib/index.js ERROR in ./node_modules/image-size/lib/types/tiff.js ERROR in ./node_modules/image-size/lib/index.js ERROR in ./node_modules/jszip/lib/readable-stream-browser.js Thanks for your help |
Hi @HoangLong93 , Well crud, so much resolving this with 2.2.0... Since Angular utilizes the single Since the issue is in the compilation phase, i'd recommend removing |
@gitbrent , well that's unfortunate. |
Please let me know what you find - i'd like to be able to have the library work with Angular (and create some sort of guide). |
Hi. I think I'm having a relate issue. I ran npm install pptxgenjs, then I tried following the library integration example here: I just created a new TS file with just the example code in it. I import it into one of my component.ts files and try to call the generatePPT function, and I get the following messages: ERROR in ./node_modules/image-size/lib/index.js Removing "image-size": ">=0.5.1", didn't seem to change anything either unfortunately. I've now done two things that seems to have potentially resolved the image-size and jszip problems. npm i stream to solve jszip problem then from this thread: I added
to the image-file library package.json file. I'm no longer getting the errors above, however now I'm getting a console error: "Uncaught TypeError: PptxGenJS is not a constructor" I change my code now to say:
And I get "pptx.setBrowser is not a function... addNewSlide is not a function... etc. It's like I'm not actually importing PptxGenJS or something. This is my code:
|
Ok. I managed to get it to work. Couple of things I did: Module not found: Error: Can't resolve 'stream' in 'C:\Users\user\Documents\angularApps\playground\value-added-selling\node_modules\jszip\lib' in angular cli, I ran npm i stream. To resolve ERROR in ./node_modules/image-size/lib/index.js Added the following to the image-size/package.json file
To resolve the warning I received for not being able to find fs in pptxgenjs, I added the code above to the pptxgenjs/package.json file as well To resolve the issue with "require," I followed these steps: Now the following seems to work as intended:
|
Thanks @jcanaan88 . I've added the |
I hit 2 errors in my project where we use webpack/Typescript.
(Note: I'm using the library in a web page)
The first error happened when building my project,
By referring to this post, I put the workaround in my webpack config
node: { fs: "empty" }
Then I hit another error when running my page in browser
Uncaught (in promise) TypeError: callback is not a function at eval (eval at <anonymous> (main.js:8466), <anonymous>:193:104)
It comes from this line of code in pptxgen.js
zip.generateAsync({type:'nodebuffer'}).then(function(content){ fs.writeFile(strExportName, content, callback(strExportName)); });
So, I comment it out as the following to bypass the error
Is there any way I can resolve the second error without changing PptxGenJS code?
The text was updated successfully, but these errors were encountered: