fix(build): remove postinstall tsc hook (regression of #3275)#3764
Merged
mrousavy merged 1 commit intomrousavy:mainfrom Apr 22, 2026
Merged
fix(build): remove postinstall tsc hook (regression of #3275)#3764mrousavy merged 1 commit intomrousavy:mainfrom
mrousavy merged 1 commit intomrousavy:mainfrom
Conversation
The `postinstall: "tsc || exit 0;"` script in packages/react-native-vision-camera/package.json runs `tsc` on every consumer install. When `tsc` is on the consumer's PATH (commonly the case on Linux CI runners and Windows dev machines), the unprovisioned `tsc` walks up the consumer's tree to find a tsconfig.json, then emits compiled .js files next to every .ts source it can reach. The `|| exit 0` swallows the error so install "succeeds", leaving stray files behind in the consumer's project. On macOS dev machines `tsc` usually isn't on the postinstall PATH, so the bug is invisible there. This re-applies the fix from mrousavy#3275, which addressed the same symptom for v4.6.x but was lost in the 5.x rewrite. The package ships a pre-built `lib/` (per the `files` field and `main: "lib/index"`), so consumers never need to compile anything on install. The existing `build: "tsc"` script remains for explicit invocation by maintainers and release tooling. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@msluszniak is attempting to deploy a commit to the Margelo Team on Vercel. A member of the Team first needs to authorize it. |
12 tasks
Owner
|
Thank you! Good catch |
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.
Summary
This re-applies the fix from #3275, which was lost in the 5.x rewrite.
The
postinstall: "tsc || exit 0;"script inpackages/react-native-vision-camera/package.jsonrunstscon every consumer install. Whentscis on the consumer'sPATH(commonly the case on Linux CI runners and Windows dev machines), the unprovisionedtscwalks up the consumer's tree to find atsconfig.json, then emits compiled.jsfiles next to every.tssource it can reach. The|| exit 0swallows the error so install "succeeds", leaving stray files behind in the consumer's project. On macOS dev machinestscusually isn't on the postinstallPATH, so the bug is invisible there — which is why it slipped past the 5.x rewrite.History
postinstallline. Merged.Real-world impact
In a downstream monorepo CI (
software-mansion/react-native-executorch), bumping vision-camera from5.0.0-beta.7to5.0.4triggered Yarn's per-version build state cache to invalidate, which re-ran thepostinstall, which then emitted compiled.jsfiles across the whole monorepo. The lint step (which uses a**/*.{js,ts,tsx}glob) then tripped on the stray files. Diagnosis and reproduction in software-mansion/react-native-executorch#1088.Why removing is correct
The package ships pre-built
lib/(per thefilesfield andmain: "lib/index"), so consumers never need to compile anything on install. The existingbuild: "tsc"script remains for explicit invocation by maintainers and release tooling.For maintainers who want compilation on git-URL installs (rare),
prepare: "tsc"would be the right hook (runs in the package's own dev workflow and on git installs but NOT for npm-registry consumers). Happy to do that variant in a follow-up if preferred — but matching the original #3275 fix seems best.Test plan
packages/react-native-vision-camera/package.jsonno longer has thepostinstallline.lib/is unchanged in the published package —npm i react-native-vision-cameracontinues to give consumers a fully-built package.npm i react-native-vision-camerano longer creates stray.jsfiles in the consumer project.🤖 Generated with Claude Code