gitbrent / PptxGenJS

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

Compatibility Issue with pptxgenjs and Vite #1325

Open 11HiteshK01 opened 3 months ago

11HiteshK01 commented 3 months ago

I'm trying to use pptxgenjs (version [3.12.0]) within a Quasar project that utilizes Vite for building. However, I'm encountering an error during the build process due to pptxgenjs's reliance on Node.js-style require statements (specifically for the https module).

Expected Behavior: The Quasar/Vite build process should successfully bundle the project without errors.

Actual Behavior: The build fails with an error message similar to: Error: The plugin "vite:dep-pre-bundle" was triggered by this import node_modules/pptxgenjs/dist/pptxgen.es.js:4883:90: 4883 │ ... require !== 'undefined' && typeof window === 'undefined' ? require('https') : null; // NodeJS Error: Build failed with 1 error: node_modules/vite/dist/node/chunks/dep-0a035c79.js:40970:10: ERROR: [plugin: vite:dep-pre-bundle] Failed to resolve entry for package "https". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "https". The package may have incorrect main/module/exports specified in its package.json.

Additional Information: @quasar/app-vite: 1.3.0 vue: 3.0.0 quasar: 2.6.0

Request:

  1. Is there a known workaround or compatibility information for using pptxgenjs in Vite projects?
  2. Are there any plans to make pptxgenjs more compatible with modern build tools like Vite?

Thank you for your time and assistance.