Open 11HiteshK01 opened 6 months ago
We are having the same issue, we are getting the following error in Angular 18 project. it looks like pptxgenjs
relies on https
package which causes the issue
Failed to resolve entry for package "https". The package may have incorrect main/module/exports specified in its package.json.
node_modules/esbuild/lib/main.js:1225:21:
1225 │ let result = await callback({
╵ ^
at packageEntryFailure (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:47164:15)
at resolvePackageEntry (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:47161:3)
at tryNodeResolve (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:46977:16)
at ResolveIdContext.resolveId (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:46727:19)
at PluginContainer.resolveId (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:49506:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:66556:15
at async file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:47480:28
at async requestCallbacks.on-resolve (C:\nds\ng-18\node_modules\esbuild\lib\main.js:1225:22)
at async handleRequest (C:\nds\ng-18\node_modules\esbuild\lib\main.js:647:11)
This error came from the "onResolve" callback registered here:
node_modules/esbuild/lib/main.js:1150:20:
1150 │ let promise = setup({
╵ ^
at setup (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:47463:13)
at handlePlugins (C:\nds\ng-18\node_modules\esbuild\lib\main.js:1150:21)
at buildOrContextImpl (C:\nds\ng-18\node_modules\esbuild\lib\main.js:873:5)
at Object.buildOrContext (C:\nds\ng-18\node_modules\esbuild\lib\main.js:699:5)
at C:\nds\ng-18\node_modules\esbuild\lib\main.js:2032:68
at new Promise (<anonymous>)
at Object.context (C:\nds\ng-18\node_modules\esbuild\lib\main.js:2032:27)
at Object.context (C:\nds\ng-18\node_modules\esbuild\lib\main.js:1874:58)
at prepareEsbuildOptimizerRun (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:51405:33)
The plugin "vite:dep-pre-bundle" was triggered by this import
node_modules/pptxgenjs/dist/pptxgen.es.js:4715:88:
4715 │ var https = typeof require !== 'undefined' && typeof window === 'undefined' ? require('https') : null; // NodeJS
╵ ~~~~~~~
X [ERROR] Failed to resolve entry for package "https". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-pre-bundle]
node_modules/esbuild/lib/main.js:1225:21:
1225 │ let result = await callback({
╵ ^
at packageEntryFailure (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:47164:15)
at resolvePackageEntry (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:47161:3)
at tryNodeResolve (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:46977:16)
at ResolveIdContext.resolveId (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:46727:19)
at PluginContainer.resolveId (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:49506:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:66556:15
at async file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:47480:28
at async requestCallbacks.on-resolve (C:\nds\ng-18\node_modules\esbuild\lib\main.js:1225:22)
at async handleRequest (C:\nds\ng-18\node_modules\esbuild\lib\main.js:647:11)
This error came from the "onResolve" callback registered here:
node_modules/esbuild/lib/main.js:1150:20:
1150 │ let promise = setup({
╵ ^
at setup (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:47463:13)
at handlePlugins (C:\nds\ng-18\node_modules\esbuild\lib\main.js:1150:21)
at buildOrContextImpl (C:\nds\ng-18\node_modules\esbuild\lib\main.js:873:5)
at Object.buildOrContext (C:\nds\ng-18\node_modules\esbuild\lib\main.js:699:5)
at C:\nds\ng-18\node_modules\esbuild\lib\main.js:2032:68
at new Promise (<anonymous>)
at Object.context (C:\nds\ng-18\node_modules\esbuild\lib\main.js:2032:27)
at Object.context (C:\nds\ng-18\node_modules\esbuild\lib\main.js:1874:58)
at prepareEsbuildOptimizerRun (file:///C:/nds/ng-18/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:51405:33)
The plugin "vite:dep-pre-bundle" was triggered by this import
node_modules/xhr2/lib/xhr2.js:117:18:
117 │ https = require('https');
╵ ~~~~~~~
3:28:13 PM [vite] Pre-transform error: Build failed with 2 errors:
node_modules/esbuild/lib/main.js:1225:21: 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.
node_modules/esbuild/lib/main.js:1225:21: 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.
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:
Thank you for your time and assistance.