Default is not a constructor

See original GitHub issue

I’m added PPTXGENJS using NPM, I added to my component in ANGULAR 5

But when I’m trying to use, I’m getting this error: pptxgenjs_1.default is not a constructor

Code:

console.log('exporting');
const pptx = new PptxGenJS();

Console:

exporting
ERROR 
TypeError: pptxgenjs_1.default is not a constructor

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
sriganeshharitzcommented, Apr 4, 2018

Hey, try this:

const PptxGenJS = require('pptxgenjs');
const pptx = new PptxGenJS();

pptx.setBrowser(true);

export function generatePPT() {
    const slide = pptx.addNewSlide();
    const opts = { x: 1.0, y: 1.0, font_size: 42, color: '00FF00' };
    slide.addText('Hello World!', opts);
    pptx.save();
}
0reactions
th30d0rcommented, May 26, 2022

it doesn’t work for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: *.default is not a constructor - Stack Overflow
I get the following error, when testing some javascript code, transpiled from a typescript file. Here is the error: Error: _mapAction2.default ...
Read more >
TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >
.default is not a constructor with ES2015 Import, Export ...
default is not a constructor with ES2015 Import, Export, browserify and class. Hi - short question for you. In my Mouse.js I export...
Read more >
TypeError: editorjs_1.default is not a constructor #929 - GitHub
I am getting the same error as #752 when importing editorjs in TypeScript TypeError: editorjs_1.default is not a constructor Failing ...
Read more >
TypeError: "X" is not a constructor in JavaScript | bobbyhadz
Attempting to use a value that is not a constructor as a constructor. Mixing up default and named imports. Using an arrow function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found