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

Eliminate .NET version .js suffix in module import #263

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

jasongin
Copy link
Member

@jasongin jasongin commented Apr 6, 2024

This fixes a small usability issue that has been bugging me while writing docs...

When loading a specific version of .NET using ES import, the .js suffix was required after the target framework moniker:

import dotnet from 'node-api-dotnet/net6.0.js'

While the .js suffix is normal for importing ES module files, the versions are not really meant to be modules but alternative entry-points. Anyway this uses the exports property in package.json to declare those entry-points without a .js suffix:

import dotnet from 'node-api-dotnet/net6.0'

(Package entry-points can be conditional and work with CommonJS also. I might use them in some other ways in the future.)

@jasongin jasongin requested a review from vmoroz April 6, 2024 06:41
@jasongin jasongin merged commit 79277b8 into main Apr 8, 2024
24 checks passed
@jasongin jasongin deleted the dev/jasongin/version-js-suffix branch April 8, 2024 19:13
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