Write tt-native package.json under both bundle key shapes on Windows
CI / Build & Test (push) Successful in 3m49s
CI / Build & Test (push) Successful in 3m49s
After unmount, the runtime may resolve #package with or without a leading slash. Write the same content to both keys so the .json loader never gets an empty entry and the host no longer crashes with "Unexpected end of JSON input" on Windows.
This commit is contained in:
@@ -183,9 +183,13 @@ function patchBundle(bundle, hosts) {
|
||||
// Ensure tt-native package.json has content in the bundle. On Windows the runtime
|
||||
// can end up reading empty content for this key (path/bundle handling), causing
|
||||
// "Unexpected end of JSON input" when the .json loader runs. Explicitly write it.
|
||||
// Write to both key shapes (with and without leading slash) so the runtime finds
|
||||
// it regardless of how the bundle protocol normalizes keys after unmount.
|
||||
const pkgPath = path.join(NATIVE_HOST_DIR, 'node_modules', 'tt-native', 'package.json')
|
||||
if (fs.existsSync(pkgPath)) {
|
||||
bundle.write(ttNativePkgKey, fs.readFileSync(pkgPath))
|
||||
const pkgContent = fs.readFileSync(pkgPath)
|
||||
bundle.write(ttNativePkgKey, pkgContent)
|
||||
bundle.write(ttNativePkgKey.slice(1), pkgContent)
|
||||
}
|
||||
console.log(' Patched tt-native binding (host-specific resolutions)')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user