Skip to content

Conversation

@nickdnk
Copy link

@nickdnk nickdnk commented Mar 5, 2024

Hello

This fixes #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
Copy link
Author

nickdnk commented Mar 5, 2024

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 nickdnk mentioned this pull request Mar 5, 2024
@EnriqCG
Copy link
Owner

EnriqCG commented Mar 6, 2024

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.

@ari-party
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rcon is not a constructor

4 participants