How do I install this plugin?

I’m having a lot of trouble attempting to use this plugin: https://github.com/koreezgames/phaser3-ninepatch-plugin

I used npm install @koreez/phaser3-ninepatch --save and it gave me some Javascript equivalents to the typescript files that the plugin was written with. For some reason, these files won’t run straight out of the box. I think it’s because it converted all the ES6 imports into some other type of import/export thing. I really lack experience in this field. Help???

Hi, sounds like you want the normal .js library, you’ll have to build it, as follows:

  • open a command prompt
  • move to the plugin directory (probably under node_modules if you have installed it as you described)
  • type ‘npm install’
  • type ‘npm run build’
  • the generated file is in dist/ninepatch.min.js

You may get problems, eg it needs webpack installed. It’s the very common npm library install/build procedure, easy if you’ve done it a few times, a nightmare if it’s your first.

Thank you! Although I wasn’t able to get it to work from the directory I installed earlier, I downloaded the repo through Github, and ran the same commands from there instead and it worked!

Open CMD
Type ‘npm install…’