rexrainbow / phaser3-rex-notes

Notes of phaser3 engine
MIT License
1.21k stars 262 forks source link

The plugins are not working in my lit/TS Project #412

Closed itsmebasti closed 7 months ago

itsmebasti commented 7 months ago

Hi there, first of all, thank you for your efforts and contribution! I am trying to add your shaking plugin to my small project. I am running a node/lit app using Typescript. When I try to add the plugin, the plugin does not have access to the Phaser dependencies. I Get this error:

Uncaught ReferenceError: Phaser is not defined
    <anonymous> http://localhost:8081/node_modules/phaser3-rex-plugins/plugins/utils/system/IsSceneObject.js:1

Is there anything I need to add, to make it work (latest versions of everything eg. Phaser, and this plugin 3.80.1)

I could add import * as Phaser from "phaser"; to every single file of this dependency, but I wonder if there is anything I need do globally to make Phaser visible to the plugin.

assigning it to globalThis or window didn't help.

rexrainbow commented 7 months ago

I use import 'phaser' for ts environment.

itsmebasti commented 7 months ago

This didn't work for me, I still get the same error. Is there any additional information I can provide? I just added you to my private project (https://github.com/itsmebasti/tractor-legacy) Feel free to run it using yarn yarn watch

npm should also work if prefered

rexrainbow commented 7 months ago

Sorry I don't want to dig into project, btw I am not familiar with typescript configuration neither.

itsmebasti commented 7 months ago

Alright, I totally understand, I will try to create an animation for the shaking instead. When I stumble over your plugins again, which I probably will, I will investigate the problem a little more in detail :)

rexrainbow commented 7 months ago

Typescript configuration is complex, it includes tsconfig.json file, and the ts-plugin used in bundle tool, different bundle tool has their own ts-plugin. :(