最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Issue importing playfab-web-sdk with TypeScript - Stack Overflow

programmeradmin3浏览0评论

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

Share Improve this question asked yesterday Quentin MourierQuentin Mourier 111 bronze badge New contributor Quentin Mourier is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Add a comment  | 

1 Answer 1

Reset to default 0

The issue indicates that there may not be a legitimate entry point in the playfab-web-sdk package.JSON.

  1. Running npm list playfab-web-sdk or cat 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.

  1. 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";
发布评论

评论列表(0)

  1. 暂无评论