How to use rexplugins in type scripts


If you use it with spine plugin like the picture above, an error occurs like the image below, so please tell me how to solve it

화면 캡처 2023-03-31 121518

Is there any more code I need to add to index.d.ts

TagText plugin is not a scene plugin, it is a global plugin (ref)

import TagTextPlugin from 'phaser3-rex-plugins/plugins/tagtext-plugin.js';
var config = {
    // ...
    plugins: {
        global: [{
            key: 'rexTagTextPlugin',
            plugin: TagTextPlugin,
            start: true
        },
        // ...
        ]
    }
    // ...
};
var game = new Phaser.Game(config)

Since you are using typescript, you can import TagText class directly. (ref)

import TagText from 'phaser3-rex-plugins/plugins/tagtext.js';

//....
var txt = new TagText(scene, x, y, content, config);
scene.add.existing(txt);

In this solution, you can load d.ts from phaser3-rex-plugins/plugins/tagtext.d.ts

oh rex!
Thank you for your direct reply

However, even if you modify it to a global plug-in
There seems to be a conflict with the Spile Plug-in.


Is there any other way?

No idea, TagText plugin won’t reference to spine plugin, i.e. they are independent imo.

1 Like