Skip to content

fix: add prepack script to generate lib/ before publishing#260

Open
gin0606 wants to merge 2 commits intosquare:masterfrom
gin0606:fix/issue-259
Open

fix: add prepack script to generate lib/ before publishing#260
gin0606 wants to merge 2 commits intosquare:masterfrom
gin0606:fix/issue-259

Conversation

@gin0606
Copy link

@gin0606 gin0606 commented Dec 20, 2025

Summary

Yarn Berry does not automatically run the prepare script during yarn pack. This causes the lib/ directory (generated by bob build) to be missing from the published npm package, resulting in the error:

The resolution for "react-native-square-in-app-payments" defined in "exports" is lib/module/index.js, however this file does not exist.

This PR adds a prepack script that explicitly runs bob build before the tarball is created, ensuring the lib/ directory is included in the published package.

Note: This PR is based on v2.0.0 tag and includes commit 3b19f0e ("update publish pipeline") which was not merged to master.

Related issues

Fix #259

Changelog

  • Fixed missing lib/ directory in published npm package by adding prepack script

Test Plan

  1. Run yarn pack and verify that lib/ directory is included in the generated tarball
  2. Verify the tarball contains lib/module/index.js and lib/typescript/src/index.d.ts

cesar-sosa-hol and others added 2 commits December 8, 2025 19:37
Yarn Berry does not automatically run the `prepare` script during
`yarn pack`. Add `prepack` script to explicitly run `bob build`,
ensuring the `lib/` directory is generated before the tarball is
created.

Fixes square#259
@CLAassistant
Copy link

CLAassistant commented Dec 20, 2025

CLA assistant check
All committers have signed the CLA.

@gin0606
Copy link
Author

gin0606 commented Jan 20, 2026

Hi @mansi-square @plinio-square @Charmis-Square 👋

I'd like to kindly request a review of this PR. This fix addresses a critical issue where the published v2.0.0 package is missing the lib/ directory, making it unusable for consumers.

Since this is a small, low-risk change (adding a prepack script), it would be great to get this merged and a patch release published so users can actually use the latest version.

Please let me know if there's anything I can do to help move this forward. Thanks!

@matanassa
Copy link

@mansi-square @plinio-square @Charmis-Square can we please get attention here?

@janroures
Copy link

any suggested fix in the meantime?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node_modules\react-native-square-in-app-payments contains an invalid package.json configuration

5 participants