Uncaught ReferenceError: WeaponPlugin is not defined

Hi,

I’ve used the phaser 3 webpack template and have then installed the phaser3-weapon-plugin via npm. However although I can see the plugin in my project bundle and I have put the line

this.plugins.installScenePlugin(‘WeaponPlugin’, WeaponPlugin, ‘weapons’, this);

in the create method of my scene, I am getting the following error in chrome:

Uncaught ReferenceError: WeaponPlugin is not defined.

I assume I’ve set something up wrong - but am hoping someone can put me out of my misery as to what it is!

Thanks, Gordon

I think you’ll have to do something like

import WeaponPlugin from 'phaser3-weapon-plugin';

Thought it would be something simple - I don’t understand why the Phaser dependency works with just the statement

import ‘phaser’

rather than needing

import Phaser from ‘phaser’

Anyway many thanks for the fix. The plugin is working, I just need to figure out why my bullets are becoming inactive instantly after being fired… :slight_smile:

Because in the first case Phaser creates a global variable, Phaser, so it works out nearly the same. :slight_smile: