Playfab not working on Cocos Creator 3.1

I use Playfab to save player data. It working with Cocos Creator 2.4.5, but with version 3.1.0 it not working and get error:

image

I install Playfab via npm: npm install playfab-sdk

import { log, _decorator } from 'cc';

import { PlayFab, PlayFabClient } from 'playfab-sdk';

import StorageAdapter from './StorageAdapter';

const { ccclass } = _decorator;

@ccclass('PlayFabAdapter')

export class PlayFabAdapter extends StorageAdapter {

    constructor (defaultData?: object) {

        super(defaultData);

        log(PlayFab);

        PlayFab.settings.titleId = 'xxxxx';

    }

    setStatistics (name: string, value: number) {

        this._set(name, value);

        let playerStatic = {

            Statistics: [{

                StatisticName: name,

                Value: value

            }]

        };

        PlayFabClient.UpdatePlayerStatistics(playerStatic, (error, result) => {

            // cc.log(error);

            // cc.log(result);

        });

    }
}

Anyone can help me fix this error?

Maybe you can refer to this post: Prefab migration plugin update

My problem is Playfab from https://playfab.com, not is Prefab

I’m not sure but Cocos Creator v3 seems to support nodejs module not as well as v2.4.5

Hello Binhpv, I am a beginner, could you please tell me how to use CocosCreator 2.4.5 with PlayFab? Is there any relevant documentation or example? Thank you :pray:

same as example above

Can I output android, IOS and H5 versions at the same time according to the above method?

I’m not sure about IOS. Android and H5 is working