Skip to content

Add ESM import support to package exports#79

Merged
tomkp merged 1 commit intomasterfrom
feature/esm-import-support
Dec 29, 2025
Merged

Add ESM import support to package exports#79
tomkp merged 1 commit intomasterfrom
feature/esm-import-support

Conversation

@tomkp
Copy link
Owner

@tomkp tomkp commented Dec 29, 2025

Summary

Problem

The smartcard package fails to import in ES module projects with:

"Error: No "exports" main defined in .../node_modules/smartcard/package.json"

This happens because the exports field only had require but no import condition.

Solution

Added import condition pointing to the same entry file as require (./dist/lib/index.js), enabling both CommonJS and ESM imports.

Test plan

  • Added unit tests for package exports configuration
  • Verified all existing tests pass
  • Verified lint passes

Fixes #78 - The package now works correctly in ES module projects by
adding the 'import' condition alongside the existing 'require' condition
in the exports field.
@tomkp tomkp merged commit 65fbba3 into master Dec 29, 2025
9 checks passed
@tomkp tomkp deleted the feature/esm-import-support branch December 29, 2025 09:16
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.

Add ESM import support to package exports

1 participant