I'm trying to use the PlayFab SDK for the web in a TypeScript project. I installed the package with:
npm install playfab-web-sdk
Then, when I try to import the module:
import * as PlayFab from "playfab-web-sdk";
I get the following error:
Error: Failed to resolve entry for package "playfab-web-sdk".
I tested importing the playfab-sdk package (which is mainly intended for server-side use) with:
npm install playfab-sdk
This one works fine, and I can import it in my TypeScript code without issues.
I compared the sources of both SDKs:
playfab-sdk
seems complete :
playfab-web-sdk
looks incomplete (but maybe I'm mistaken?) :
I'm trying to use the PlayFab SDK for the web in a TypeScript project. I installed the package with:
npm install playfab-web-sdk
Then, when I try to import the module:
import * as PlayFab from "playfab-web-sdk";
I get the following error:
Error: Failed to resolve entry for package "playfab-web-sdk".
I tested importing the playfab-sdk package (which is mainly intended for server-side use) with:
npm install playfab-sdk
This one works fine, and I can import it in my TypeScript code without issues.
I compared the sources of both SDKs:
playfab-sdk
seems complete :
https://github.com/PlayFab/NodeSDK/tree/master/PlayFabSdk
playfab-web-sdk
looks incomplete (but maybe I'm mistaken?) : https://github.com/PlayFab/JavaScriptSDK/tree/master/PlayFabSdk
1 Answer
Reset to default 0The issue indicates that there may not be a legitimate entry point in the playfab-web-sdk package.JSON.
- Running
npm list playfab-web-sdk
orcat node_modules/playfab-web-sdk/package.json
will allow you to verify this.
If "main" or "module" are absent or misspelled, the package may not be set up correctly for direct import.
- Employ a Direct Import Path (Short-Term Solution) Try importing the module using a relative path as the package might not expose a correct module entry:
import * as PlayFab from "./node_modules/playfab-web-sdk/PlayFabClientApi";