Skip to content

fix: fix package resolution for native esm#14

Closed
salza80 wants to merge 2 commits into
masterfrom
esmsupport
Closed

fix: fix package resolution for native esm#14
salza80 wants to merge 2 commits into
masterfrom
esmsupport

Conversation

@salza80

@salza80 salza80 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Fix native Node ESM package resolution

Summary

This adds an explicit exports map so native Node ESM resolves erroz to the ESM build instead of falling back to the UMD/CommonJS main entry.
This fixes error:
SyntaxError: The requested module 'erroz' does not provide an export named 'erroz'

The package now maps:
import to dist/erroz.mjs
require to dist/erroz.umd.js
types to dist/main.d.ts

@salza80 salza80 requested a review from Copilot June 25, 2026 13:28
@salza80 salza80 added the bug label Jun 25, 2026
@salza80 salza80 self-assigned this Jun 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to ensure the erroz package resolves correctly in native Node ESM (including named exports) by adding an explicit exports map and a CI-style verification script, along with a patch version bump and changelog entry.

Changes:

  • Add package.json#exports mappings for import/require/types to fix native Node ESM resolution.
  • Add a Node script to verify ESM named imports and CommonJS require against the built package.
  • Bump version to 2.0.2 and document the change in CHANGELOG.md.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
scripts/verify-package-exports.mjs Adds an automated runtime check validating ESM/CJS consumption of the package entrypoint.
package.json Introduces an exports map and wires the export verification into npm test.
package-lock.json Updates lockfile metadata for the version bump.
CHANGELOG.md Documents the 2.0.2 change related to native ESM exports.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/verify-package-exports.mjs
@salza80 salza80 changed the title fix: fix for native esm fix: fix package resolution for native esm Jun 25, 2026
@salza80 salza80 requested a review from Copilot June 25, 2026 13:36
@salza80 salza80 requested a review from jhnns June 25, 2026 13:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

@jhnns

jhnns commented Jun 27, 2026

Copy link
Copy Markdown
Member

Thank you for your effort @salza80
I decided to switch erroz to our template repository: #15

It's now published as ESM only..

@jhnns jhnns closed this Jun 27, 2026
@salza80

salza80 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for your effort @salza80 I decided to switch erroz to our template repository: #15

It's now published as ESM only..

Perfect! Tested it on my konsens branch - all working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants