ParticleStorm - How can I install plugins when I use Phaser from NPM?

I’ve used Particle Storm in the past when I had Phaser and Particle Storm installed with Vanilla JS tags.

Recently, I’ve started building games on top of Angular and I installed Phaser CE with NPM install.
I import phaser and create games in angular components with: import { Game, AUTO } from ‘phaser-ce’;

I cannot get Particle Storm working for the life of me. I’ve been searching around and tried everything I’ve seen.

How can I install plugins with this setup?

Hi Devin,

try using import this way:
import ‘particlestorm’;
And then add it as plugin this way:
let manager: Phaser.ParticleStorm = this.game.plugins.add(Phaser.ParticleStorm);

It worked for me :wink:

Hey mcofko, thanks for your help!

I tried that and I got this error: Module not found: Error: Can’t resolve ‘…/…/…/assets/scripts/particlestorm’

Is there anything else I need to do, outside of importing particle storm in the component my game lives?

Are you using Webpack?
If you do, then add this code into webpack.config.js:

resolve: {
plugins: [new TsconfigPathsPlugin()],
extensions: [’.ts’, ‘.js’],
alias: {
particlestorm: path.join(root, [path to the particle-storm.js])
}
}

I’m using Webpack but the config isn’t mutable because I’m developing an Angular cli app. Any idea how to get it working without modifying that file?

Thanks!