How to draw a rectangle alone?

var config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    scene: {
        create: create
    }
};

var game = new Phaser.Game(config);

function create() {
    this.add.rectangle(100, 100, 100, 100, 0xee0000);
    var graphics = this.add.graphics();

    var polygon = new Phaser.Geom.Polygon([
        200, 150,
        400, 300,
        600, 150,
        750, 300,
        600, 450,
        200, 450,
        50, 300
    ]);

    graphics.fillStyle(0x00aa00);
    graphics.fillPoints(polygon.points, true);
}

This will draw a rectangle and a polygon. But when I remove the code for the polygon, leaving just the first line in the create function, the rectangle also won’t be drawn anymore. Why is that? What part of the polygon/graphics part is necessary for the rectangle to be drawn?

I think you remove the closing brace of the create function, because the above code doesn’t show any problem.

To be clear: This code did not draw a rectangle with Phaser version 3.15.1:

var config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    scene: {
        create: create
    }
};

var game = new Phaser.Game(config);

function create() {
    var foo = this.add.rectangle(100, 100, 100, 100, 0xee0000);
}

I just upgraded to version 3.55.2, and now there is a rectangle.