Jump to content

Google Closure Compiler


matias_ini
 Share

Recommended Posts

Hi, I am trying to minimize a Phaser project using Google Closure Compiler.

I have no problems using SIMPLE_OPTIMIZATIONS as it does not change the name of the functions and properties but if I try to use ADVANCED_OPTIMIZATIONS the code does not work.

I know that to solve it you have to use a file with the externs, but how exactly do I assemble this file so as not to have conflicts with all the functions and properties of Phaser?

Of this simple code:

var GamePlayManager = {
    init: function() {
        console.log("init");
    },
    preload: function() {
        console.log("preload");
    },
    create: function() {
        console.log("create");
    },
    update: function() {
        console.log("update");
    }
}

var game = new Phaser.Game(1136, 640, Phaser.CANVAS);
    
game.state.add("gameplay", GamePlayManager);
game.state.start("gameplay");

I get this:

var a=new Phaser.b(1136,640,Phaser.a);a.state.add("gameplay",{c:function(){console.log("init")},preload:function(){console.log("preload")},create:function(){console.log("create")},update:function(){console.log("update")}});a.state.start("gameplay");

When creating the Phaser project you see Phaser.b instead of Phaser.Game.

There are many functions and properties in Phaser so it would be impossible to put all in the extern file by hand unless it is already created by someone?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...