Hello, I'm running into an issue where I've trouble loading the playfab sdk in TypeScript.
Code below:
import { _decorator, Component, Node, Label } from 'cc';
const { ccclass, property } = _decorator;
// Error is here
import PlayFab from 'playfab-web-sdk';
@ccclass('NewComponent')
export class NewComponent extends Component {
start() {
}
update(deltaTime: number) {
}
}
I've installed the playfab sdk via npm and the vscode is auto-completing import PlayFab from 'playfab-web-sdk';
which means it's recognized. However, I do not understand what I need to do from here on.
After googling and learning more about TypeScript. I still have question marks as the code in PlayFab.d.ts
is a tad different than most examples found on the web.
Any suggestions?
Thanks in advance!
Update: adding a decs.d.ts to the root of my project including declare module 'playfab-web-sdk'
fixed the above problem, but when trying to run the code an error is thrown: index.js:1 Error: Error: Module "<main>" not found for file:///C:/Projects/CardboardCore/PlayFabTest/node_modules/playfab-web-sdk/
When trying to create a build, some extra information is given: ModuleNotFoundError: (i18n needed)resolve_error_module_not_found: {"specifier":"<main>","parentURL":"file:///C:/Projects/CardboardCore/PlayFabTest/node_modules/playfab-web-sdk/"}
This is happening using Cocos Creator.
Any support would be great!