The simplest way to use the Spine Plugin is to include the plugin script in your HTML and then add it as a default scene plugin when configuring the game.
Use SpinePlugin.js
or an alternative in phaser/plugins/spine/dist. Make sure Phaser and the plugin are the same version.
<script src="https://cdn.jsdelivr.net/npm/phaser@3.51.0/dist/phaser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/phaser@3.51.0/plugins/spine/dist/SpinePlugin.js"></script>
Then use the global SpinePlugin
to add the plugin to the game.
new Phaser.Game({
plugins: {
scene: [{ key: "SpinePlugin", plugin: SpinePlugin, mapping: "spine" }],
},
});