Annoraaq / grid-engine

A grid based movement engine compatible with Phaser3.
https://annoraaq.github.io/grid-engine/
Apache License 2.0
235 stars 20 forks source link

No longer working with Webpack? #499

Open TorbenTK opened 1 week ago

TorbenTK commented 1 week ago

For a new dev project, we're using the lastest versions of Webpack (5.91.0) and Phaser (3.80.1).

I maintain a number of older projects, one of these uses Grid Engine (2.34.0) with an older version of Webpack (5.4.0) but the latest version of Phaser (3.80.1). I don't know what changed recently, but it seems that Grid Engine no longer properly works with the (newer) versions of Webpack.

When I run the project, the following happens:

__actions__: [],
__chain__: false,
__index__: 0,
__values__: undefined
__wrapped__: [Object object] (in this case the Scene in question)

I'm not sure where to go from here. I've tried a number of things (see below); the only thing I'm still to try is to manually add it using his.plugins.installScenePlugin to bypass Webpack, but that's not the most ideal solution.

How to reproduce

The easiest way to reproduce it is to use your example project (https://github.com/Annoraaq/grid-engine-ts-example) and then apply the Phaser webpack template on top of it (https://github.com/phaserjs/template-webpack). My project's setup is close to it and I've tested it with the example projects to find out when stuff actually stopped working, which was when Webpack was added.

I did notice is that Phaser console logs that gridEngine as a plugin is missing if imported as { GridEngine }. If that happens, the plugin is indeed undefined and create() fails as well.

Importing as GridEngine instead of { GridEngine } resolves this but allows only(?) create() to work.

Extra information

Annoraaq commented 1 week ago

Is this problem tied to typescript?

I used https://github.com/phaserjs/template-webpack and added GridEngine (JS only) and I don't get that error message:

https://silver-waddle-vr5vp6vg5jfx5r.github.dev/

This is the first time I am trying codespaces, so let me know if you can't access it.

TorbenTK commented 1 week ago

TypeScript should be fine, but I'll check the codespace example tomorrow just to be sure.

TorbenTK commented 6 days ago

Sorry for the delay. I can't see your example unfortunately. I'm using TypeScript version 5.4.5 for the new project whilst the older project uses TypeScript 4.1.3.

The JS version works fine for me (using template-webpack first, then applying the Basic Movement example from the docs on top of it).

Ran a few more tests for the new project, downgrading to versions that the older functional project uses, weirdly enough I still can't get Grid Engine running (Typescript, Grid Engine, Phaser and Webpack were all downgraded).

Will try again this weekend, keep you posted.

Annoraaq commented 5 days ago

Too bad with the codespace. I guess they are not easily sharable. Anyway, a minimum executable example that demonstrates the issue would be appreciated.