Embed plugin within rest of the game code

I’ve been getting along great with my first proper game in Phaser 3. I’ve been using Koala to compile & minify all of my code into a single game.min.js file, and that’s been working well too.

I now need to use a @rexrainbow plugin (specifically the RexBBCode plugin). I’m currently loading this via a preload within a scene:

this.load.plugin('rexbbcodetextplugin', 'js/plugins/rexbbcodetextplugin.min.js', true);

…and again, it works brilliantly. However, I want to be able to compile it into the single game.min.js along with everything else, and then instantiate the plugin without having to load an external file. But I can’t figure out how on earth to do it.

Does anybody have any ideas? (FYI I’m not using npm or Webpack - just vanilla JS and Koala to pack everything together)

I think you can combine rexbbcodetextplugin.min.js with rest (after Phaser, before your game code) and use

/* global rexbbcodetextplugin */

new Phaser.Game({
  plugins: {
    global: [{
      key: 'rexBBCodeTextPlugin',
      plugin: rexbbcodetextplugin,
      start: true
    }
    ]
  }
});