colyseus / colyseus.js

⚔ Colyseus Multiplayer SDK for JavaScript/TypeScript
https://docs.colyseus.io/getting-started/javascript-client/
MIT License
407 stars 105 forks source link

remove decentralandLibrary and exports #123

Open gonpombo8 opened 1 year ago

gonpombo8 commented 1 year ago

ts error when importing file from dist path: The path "./dist/colyseus-decentraland" is not exported by package "colyseus.js":

endel commented 1 year ago

Hi @gonpombo8. I'm not too familiar with the latest SDK7 on Decentraland, can you provide more background info, and how to reproduce the issue?

The "exports" field is mandatory for most javascript build tooling, and "decentralandLibrary" is (was?) the way to specify module entrypoint for Decentraland.

Cheers

endel commented 1 year ago

Hi @gonpombo8, I see! Thanks for the details.

Can you try colyseus.js@0.15.2? I've added a "./decentraland" export.

It should be possible to import like this now:

import { Client, Room } from "colyseus.js/decentraland";
gonpombo8 commented 1 year ago

Hi @gonpombo8. I'm not too familiar with the latest SDK7 on Decentraland, can you provide more background info, and how to reproduce the issue?

The "exports" field is mandatory for most javascript build tooling, and "decentralandLibrary" is (was?) the way to specify module entrypoint for Decentraland.

Cheers

Hi @endel. Yes, sure. Thanks for the response. 😁

We are using esbuild for the build process for the scenes and we can import any file/package now, so the decentralandLibrary is no needed anymore for the SDK7.

If I try to import directly the file colyseus-decentraland.js from the dist folder then i get an error because the exports field defined of the package.json. Maybe we can still have the decentralandLibrary for the sdk6, but can we change the entryPoint of the exports so it points directly to the dist/decentraland-colyseus.js or remove the exports at all ?

Here is the error to have more context: image

gonpombo8 commented 1 year ago

Hi @gonpombo8, I see! Thanks for the details.

Can you try colyseus.js@0.15.2? I've added a "./decentraland" export.

It should be possible to import like this now:

import { Client, Room } from "colyseus.js/decentraland";

THANKS!!!! 🤍 Now it works and bundles right, the only thing that I'm seeing is this new error. Maybe its related to the changes on the function send to use fetch ? image

endel commented 1 year ago

Hard to say what's the issue there. Can you send me the final build so I can take a look? If you'd like to we can chat via Discord to speed this up (my user is endel#2163)