fix(build): restore exports field in dist/package.json - #105
Open
Olovyannikov wants to merge 1 commit into
Open
Conversation
The dist package.json generator used a typo `export` instead of `exports` (reading the non-existent `Existing.export`), so the published package lost its `exports` map. Without it, bundlers resolve the CJS build and the `@effector/reflect/scope` subpath breaks; the CJS entry also triggers a dual-package hazard with effector-react, losing the Provider scope inside `variant`/`reflect`. Also add a guard in validate_dist.mjs so a missing exports field fails the dist validation instead of being silently ignored. Closes effector#104
|
|
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.
Problem
build.mjsgeneratesdist/package.jsonfrom a whitelist of fields, but uses a typoexport: Existing.export(singular, non-existent) instead ofexports: Existing.exports(introduced in cef40e6). As a result the published 10.1.0 package has noexportsfield.Impact
@effector/reflect/scopesubpath no longer resolves.main(CJS). The CJS entryrequires its own copy ofeffector-react, causing a dual-package hazard:<Provider>(ESM) anduseUnitinsidevariant/reflect(CJS) reference different effector-react instances, so the forked scope is lost —variantreads the store default instead of the scoped value.Reproduced in a React 19 app:
variant({ if: $store, then, else })under<Provider value={fork(...)}>rendered thethenbranch even though the scoped value wasfalse. Pinning back to 10.0.2 (which still shippedexports) fixed it.Fix
build.mjs:export→exports.validate_dist.mjs: fail when the generateddist/package.jsonis missing theexportsfield (././scope). The existingattw/publintcalls swallow their errors, so the regression went unnoticed.Verify
pnpm buildnow emitsdist/package.jsonwith the fullexportsmap (both.and./scopeconditions).Closes #104