Skip to content

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

Merged
Jason Ginchereau (jasongin) merged 1 commit into
mainfrom
dev/jasongin/version-js-suffix
Apr 8, 2024
Merged

Jason Ginchereau (jasongin) merged 1 commit into
mainfrom
dev/jasongin/version-js-suffix

Conversation

@jasongin

Copy link
Copy Markdown
Member

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
Jason Ginchereau (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