gitbrent / PptxGenJS

Create PowerPoint presentations with a powerful, concise JavaScript API.
https://gitbrent.github.io/PptxGenJS/
MIT License
3k stars 645 forks source link

[BUG] ES6 Integration with Svelte-Kit support #1116

Closed muxles closed 2 years ago

muxles commented 2 years ago

Thank you for reporting an issue, suggesting an enhancement, or asking a question.

We appreciate your feedback - to help the team understand your needs please complete the below template to ensure we have the details to help. Thanks!

Please check out the Docs to see if your question is already addressed there. This will help us ensure our documentation covers the most frequent questions.

Category

Version

Please specify what version of the library you are using: [3.10.0]

Please specify what version(s) of PowerPoint you are targeting: [2016/2019]

If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.

Expected / Desired Behavior / Question

PptxGenJS should run as expected within Svelte-Kit.

Observed Behavior

Errors are produced when attempting to import PptxGenJS. ERROR: [plugin: vite:dep-pre-bundle] Failed to resolve entry for package "https".

Steps to Reproduce

  1. Install Svelte-Kit
  2. Install PptxGenJS via NPM.
  3. Create a file that imports pptxgenjs.
  4. npm run dev

Errors will occur.

gitbrent commented 2 years ago

This is an integration question, not a bug.

Add the necessary libraries into your package file as needed.

Ex:

  "dependencies": {
    "https": "^1.0.0",
    "image-size": "^1.0.0",
    "jszip": "^3.7.1"
  },
front-endLiu commented 2 years ago

ERROR: [plugin: vite:dep-pre-bundle] Failed to resolve entry for package "https". Is there any way to solve the errors caused by vite? @muxles

fwestling-lor commented 2 years ago

@gitbrent I disagree that it's purely an integration question - https hasn't been updated in 8 years and doesn't seem to work with modern build tools, so depending on it is bad for future proofing. The earlier comment relating to Vite is the same issue that I'm having, though I was able to fix it with a patch-package replacing your require("https") calls with require("node:https") -- I've attached the patch file here, so @front-endLiu if you want to try that as a fix, just extract this file to your root directory and call npx patch-package.

patches.zip

I haven't tested this thoroughly and I don't have the resources to, but it's maybe a starting point

afreidz commented 1 month ago

Also would like to disagree with this being an integration issue. This is an issue of a dependency not being modernized and will prevent this library for being built using vite. which, as I am sure we all know, powers a measurable amount of modern development builds. Can this be reopened and addressed?