Please specify what version of the library you are using......: 3.12.0
Please specify what version(s) of PowerPoint you are targeting: [ ]
Please specify what web browser you are using.................: chrome 115.0.5790.110
Description
When import PptxGenJS from 'pptxgenjs'; the angular compiler warns about pptxgenjs being a commonjs module, which is valid. But when import PptxGenJS from 'pptxgenjs/dist/pptxgen.es.js'; typescript complains about not being able to find a type declaration file. When ignoring that with a @ts-ignore, the app compiles, but angular still warns about pptxgenjs being a commonjs module.
The warning is as follows:
Warning: /home/projects/node-gmxzct/src/app/app.component.ts depends on 'pptxgenjs'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
I was able to 'fix' this by modifying the package.json of pptxgenjs to include the following, but this is not desired, as this is removing the entrypoint for the commonjs bundle:
"type": "module",
"main": "dist/pptxgen.es.js",
Another 'fix' is to add pptxgenjs to the allowedCommonJsDependencies in angular.json, but this only supresses the warning.
Desired Behavior
Importing the esm bundle should work properly and the angular compiler should show no warning about pptxgenjs being a commonjs module.
Observed Behavior
Warning: /home/projects/node-gmxzct/src/app/app.component.ts depends on 'pptxgenjs'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Issue Category
Product Versions
Description
When
import PptxGenJS from 'pptxgenjs';
the angular compiler warns aboutpptxgenjs
being a commonjs module, which is valid. But whenimport PptxGenJS from 'pptxgenjs/dist/pptxgen.es.js';
typescript complains about not being able to find a type declaration file. When ignoring that with a@ts-ignore
, the app compiles, but angular still warns aboutpptxgenjs
being a commonjs module.The warning is as follows:
I was able to 'fix' this by modifying the
package.json
ofpptxgenjs
to include the following, but this is not desired, as this is removing the entrypoint for the commonjs bundle:Another 'fix' is to add
pptxgenjs
to theallowedCommonJsDependencies
inangular.json
, but this only supresses the warning.Desired Behavior
Importing the esm bundle should work properly and the angular compiler should show no warning about
pptxgenjs
being a commonjs module.Observed Behavior
Steps to Reproduce
See terminal in this stackblitz: https://stackblitz.com/edit/node-gmxzct?file=src%2Fapp%2Fapp.component.ts
Also try to import the esm bundle and see the same warning being shown in the terminal (app restart required. Use
yarn start
).