Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert export to default export #11

Merged
merged 1 commit into from
Jan 3, 2021

Conversation

c43721
Copy link
Contributor

@c43721 c43721 commented Jan 3, 2021

Reason for this change is because of the following:

import Rcon from 'rcon-srcds';

// Results in TypeError: rcon_srcds_1.default is not a constructor

However, if we use the alternative syntax to import everything as a constant:

import * as Rcon from 'rcon-srcds';

// Results in This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.

Changes:

// Old
export = RCON

// New
export default RCON

With the default export, everything works as expected.

@EnriqCG
Copy link
Owner

EnriqCG commented Jan 3, 2021

Default export in an ECMAScript2017+ context makes sense. This module was originally written in 2018 in plain JS, and export = RCON was the normal convention 🤷‍♂️.

This is a very welcome change. Thanks, @c43721.

@EnriqCG EnriqCG merged commit 150c040 into EnriqCG:master Jan 3, 2021
@EnriqCG
Copy link
Owner

EnriqCG commented Jan 3, 2021

Release v.2.0.1 has been published to NPM including changes in this PR.

@c43721
Copy link
Contributor Author

c43721 commented Jan 3, 2021

Awesome! I'll change over my backend to use this package now.

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.

2 participants