Skip to content

fix: Package exports for the main entry #28

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

Merged
merged 1 commit into from
Jan 12, 2024
Merged

Conversation

JayaKrishnaNamburu
Copy link
Member

@JayaKrishnaNamburu JayaKrishnaNamburu commented Jan 12, 2024

Error

node:internal/process/esm_loader:40
      internalBinding('errors').triggerUncaughtException(
                                ^
Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "dist/loader.js" defined in the package config /home/runner/work/api/api/node_modules/@jspm/node-importmap-loader/package.json imported from /home/runner/work/api/api/; targets must start with "./"
    at new NodeError (node:internal/errors:405:5)
    at invalidPackageTarget (node:internal/modules/esm/resolve:404:[10](https://github.com/jspm/api/actions/runs/7503600112/job/20428695764?pr=13#step:7:11))
    at resolvePackageTargetString (node:internal/modules/esm/resolve:457:[11](https://github.com/jspm/api/actions/runs/7503600112/job/20428695764?pr=13#step:7:12))
    at resolvePackageTarget (node:internal/modules/esm/resolve:536:[12](https://github.com/jspm/api/actions/runs/7503600112/job/20428695764?pr=13#step:7:13))
    at packageExportsResolve (node:internal/modules/esm/resolve:650:27)

Fixes

The package.json exports should always prefix with ./ when exposing the entry points. Or else node will throw a error when used as

node --loader @jspm/node-importmap-loader test/test.js

@JayaKrishnaNamburu JayaKrishnaNamburu self-assigned this Jan 12, 2024
@JayaKrishnaNamburu JayaKrishnaNamburu added the bug Something isn't working label Jan 12, 2024
@yowainwright yowainwright merged commit 2e75458 into main Jan 12, 2024
@yowainwright yowainwright deleted the fix/package-exports branch January 12, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants