problems doing an import from a cdn

0 favourites
  • 3 posts
  • I'm trying the following code and it gives an error that PptxGenJS is not defined.

    // Import any other script files here, e.g.:

    // import * as myModule from "./mymodule.js";

    import * as pptxgen from "";

    runOnStartup(async runtime =>


    // Code to run on the loading screen.

    // Note layouts, objects etc. are not yet available.

    runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));


    async function OnBeforeProjectStart(runtime)


    // Code to run just before 'On start of layout' on

    // the first layout. Loading has finished and initial

    // instances are created and available to use here.


    runtime.addEventListener("tick", () => Tick(runtime));


    function Tick(runtime)


    // Code to run every tick


    export function pptxdemo()


    let pptx = new PptxGenJS();

    let slide = pptx.addSlide();

    slide.addText("This is an amazing demo", {

    x: 0,

    y: 1,

    w: "100%",

    h: 2,

    align: "center",

    color: "0088CC",

    fill: "F1F1F1",

    fontSize: 24,


    pptx.writeFile({ fileName: "PptxGenJS-Demo" });


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here's the sample project if someone wants to take a look.

    It should generate a simple powerpoint file if it works. It uses the Pptxgen library. I've tested the javascript on before putting in construct.

  • The file from the CDN doesn't look like a javascript module. There is no export of the PptxGenJS variable.

    You probably should add the js file to your project and do an export of said variable.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)