fix(vite): rebuild the cached core bundle when a patch-package core patch changes - #11408
Merged
Merged
Conversation
…atch changes The persisted esbuild core bundle is keyed on core's package.json mtime, which patch-package leaves untouched when it rewrites files inside node_modules/@nativescript/core — so a patched core kept serving the cached, unpatched bundle until the cache was deleted by hand. The names, sizes and mtimes of patches/@NativeScript+core*.patch now join the key.
|
View your CI Pipeline Execution ↗ for commit 818a06e
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
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.
The dev server's esbuild core bundle is persisted under
node_modules/.ns-vite/core-bundle-<platform>-<key>.mjsand reused while its cache key matches. The key includes core'spackage.jsonmtime to detect reinstalls, but patch-package rewrites files insidenode_modules/@nativescript/coreand never touchespackage.json. So after adding, changing or removingpatches/@nativescript+core+<version>.patch, the device keeps booting the previously cached, unpatched core until the cache is deleted by hand or the run is started withNS_CORE_BUNDLE_NO_DISK_CACHE=1.This is easy to hit and hard to notice:
/ns/m/node_modules/@nativescript/core/...serves the patched file (socurllooks right), while the running app evaluates the stale single-eval bundle.Fix
readCorePatchesSignature(projectRoot)listspatches/@nativescript+core*.patch(patch-package's file naming) and folds each file's name, size and mtime into the core bundle cache key ascorePatches. A missingpatches/directory contributes an empty signature, so projects without patches keep the same behavior as before.