Skip to content

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
@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.

3 participants