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

Fix inability to get version from package.json #128

Merged
merged 1 commit into from
Apr 19, 2022

Conversation

phschaad
Copy link
Contributor

require('./package') alone fails in some cases (i.e. Node versions), because that's not a valid package. Specifying the file ending fixes this issue and should be version independant. For reference and possible other ways of obtaining the version from code: https://stackoverflow.com/questions/9153571/is-there-a-way-to-get-version-from-package-json-in-nodejs-code

`require('./package')` alone fails in some cases (i.e. Node versions), because that's not a valid package. Specifying the file ending fixes this issue and should be version independant. For reference and possible other ways of obtaining the version from code: https://stackoverflow.com/questions/9153571/is-there-a-way-to-get-version-from-package-json-in-nodejs-code
@markstos
Copy link
Collaborator

What's an example of a version of Node where this fails? We only support the latest LTS release and newer, currently Node 14.

@markstos markstos added the needs-info Needs more information to move forwards label Apr 18, 2022
@phschaad
Copy link
Contributor Author

I have in fact noticed that it is not an issue with Node, but rather when using webpack to compress/bundle the code for deployment. Tested with webpack version 5.72.0.

Copy link
Collaborator

@markstos markstos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is harmless and aligned with how ESM modules work by requiring a full path.

@markstos markstos merged commit 1c25c3a into node-strava:main Apr 19, 2022
@phschaad
Copy link
Contributor Author

Thank you!

@phschaad phschaad deleted the patch-1 branch April 19, 2022 18:49
@markstos
Copy link
Collaborator

Thanks. Release today in v2.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-info Needs more information to move forwards
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants