Object is of type "initialize"

In my modularized project, my tilemap works well, here is the start of the create method for my level 1 class.

create(){

  this.map = this.add.tilemap("level1_map");
  var tileset = this.map.addTilesetImage("tileset", "level1_tileset", 16, 16, 1, 2);
  console.log(this.map)
  this.layer = this.map.createLayer(0, tileset, 0, 0)

In the modularized version, everything is fine, the log statement shows that it’s a Tilemap object and it has the createLayer method.

But after packaging into one file with webpack, the log statement shows this with the following error.

It says this.map (and everything else) is of type “initialize”, whatever that means. Nothing is different about the code, all I did was package it. I thought maybe the issue was that I’m not including the map.json or tileset correctly, but I’ve double checked and they seem fine.

What does it mean when something is of type “initialize” ?

The initialize thing is annoying but not important, it’s just a quirk of Phaser 3’s class helper.

Your error may come from mixing Phaser versions somehow. Which Phaser version appears in the console?

1 Like

You’re right, the versions are different. The console says it’s version 3.24.1. I can’t find this anywhere in my packaged project. I have it set to 3.54.0 in my package.json.

EDIT:
I found it in the production-dependencies. I had to npm install phaser to truly update the version. Thanks Samme.