[optimize] support ESM exports of NPM#36
Merged
Conversation
Closed
Copilot
AI
changed the title
[WIP] Support NPM standard ESM export configuration
Add standard npm ESM exports for Deno/Node consumers
Jul 1, 2026
TechQuery
approved these changes
Jul 1, 2026
There was a problem hiding this comment.
Pull request overview
This PR updates the published package entrypoint metadata so ESM consumers (including Deno npm: imports) resolve to an ESM build (dist/index.mjs) instead of falling back to CommonJS, and adds a regression test to lock the entrypoint contract.
Changes:
- Switch
package.json"module"entry todist/index.mjsand add an"exports"map routingimportvsrequireto the correct artifacts. - Add a package-level Jest test asserting the expected
package.jsonentrypoint/export fields. - Bump package version from
4.7.1to4.7.2.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| package.json | Adds an exports map and updates the ESM entry to dist/index.mjs (plus version bump). |
| test/package.spec.ts | Adds a regression test asserting the package entrypoint/export contract. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
web-utilityexposed the right symbols in source, but published package entry resolution still fell back to CommonJS for bare ESM consumers. That caused Denonpm:imports likechangeMonthto fail at module instantiation time.Package entrypoints
exportsmap for the root package./dist/index.mjs./dist/index.js./dist/index.d.tsESM artifact naming
dist/index.esm.jstodist/index.mjsRegression coverage
package.json{ "main": "dist/index.js", "module": "dist/index.mjs", "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.mjs", "require": "./dist/index.js", "default": "./dist/index.js" } } }