Repository navigation
build: add missing exports field - #3
Merged
Merged
Conversation
pi0
reviewed
Apr 20, 2026
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
pi0
approved these changes
Apr 20, 2026
pi0
left a comment
Member
There was a problem hiding this comment.
Thnx! I have simplified exports field for better compatibility
Contributor
Author
|
Thanks ! 😍 |
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.
👋🏼 I’m currently working on a Slidev addon based on my article, and I’ve encountered the following issue. I may be overlooking something, so I’d appreciate any feedback if my approach isn’t correct 😊
Problem ❌
The
coderaftpackage currently has noexports,main, ormodulefield in itspackage.json. This means Node.js and bundlers have no declared entry point for the package.When a user tries to import
coderaftprogrammatically in a project using a bundler (Vite, esbuild, Rollup, webpack), the tool attempts to resolve the package entry point and fails:This makes
import { startCodeServer } from "coderaft", the exact usage shown in the README, seems impossible in any bundler context. Users can only use the CLI (npx coderaft), not the programmatic API.How ❓
Add an
exportsfield pointing to the existingdist/index.mjsoutput:Breaking change ❌
This is technically a breaking change for any code importing internal subpaths directly (e.g.
import ... from 'coderaft/dist/index.mjs'). Withexportsdefined, only declared subpaths are accessible. However, since the package was not importable at all without this field, the real-world impact is minimal I think 😊