rcon-srcds icon indicating copy to clipboard operation
rcon-srcds copied to clipboard

Fix Rcon is not a constructor

Open nickdnk opened this issue 1 year ago • 3 comments

Hello

This fixes https://github.com/EnriqCG/rcon-srcds/issues/13 which just broke my system (again).

I'm not very well-versed in node or modules, but I know this makes the package work as a module and prevents the above error, probably without breaking anything else, as I left the normal export default in there.

nickdnk avatar Mar 05 '24 21:03 nickdnk

To clarify, the JS output from tsc simply becomes this, which seems to work fine.

// rcon.js
exports.default = RCON;
module.exports = RCON;

I'm using the package like this. All other dependencies in the project work fine using the import statement, just like the readme for this package tells me to do.

// package.json
{
  "type": "module",
  "dependencies": {
    "typescript": "^5.1.6",
    "rcon-srcds": "^2.1.0"
  }
}
// app.ts
import RCON from "rcon-srcds";

new RCON({...});
        
// error

For TypeScript I'm using "target": "ES2022" and "module": "ES2022"

nickdnk avatar Mar 05 '24 21:03 nickdnk

At first glance, this does not look like it's gonna be an issue. I want to make sure this works properly though, so I'll verify it before merging.

EnriqCG avatar Mar 06 '24 23:03 EnriqCG

I have published Nico's branch to @robertsspaceindustries/rcon-srcds until it is merged and published.

ari-party avatar May 15 '24 11:05 ari-party