GeezerVison is showing github.com — fix(windows): break import cycle between view and animation modules by aleclarson · Pull Request #11581 · NativeScript/NativeScript
Conversation
Summary
view-common imports Animation from ui/animation, whose Windows index imported _ensureNativeTransforms back from the platform view barrel (ui/core/view/index) — a view-common → animation → view → view-common cycle that does not exist on Android (index.android.ts has no such import).
- When the bundler (Vite/rolldown) flattens both modules into one chunk it evaluates the platform
View class body — [originXProperty.setNative], [isEnabledProperty.setNative], etc. — before view-common's property declarations run, so the app crashes at startup with TypeError: Cannot read properties of undefined (reading 'setNative'). Under plain ESM evaluation the same cycle produces a TDZ error.
- Moves
_ensureNativeTransforms into a leaf module (native-transforms.windows) imported by both files; it only touches WinRT types, so the edge from animation back into the view module disappears. The public re-export from ui/core/view is preserved (.d.ts unchanged in shape — _ensureNativeTransforms remains exported from the same specifier).
Test plan
-
tsc --noEmit -p packages/core/tsconfig.lib.json — clean
- Rebuilt an Octane Xplat Windows app (
@nativescript/core@abae298 + this change applied as a patch): generated vendor.mjs no longer references the uninitialized binding; the packaged app boots past module evaluation
-
apps/toolbox Windows run
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
view-common imports Animation from ui/animation, whose Windows index
imported _ensureNativeTransforms back from the platform view barrel.
When the bundler flattened both modules into one chunk it evaluated the
platform View class body — [originXProperty.setNative] and friends —
before view-common's property declarations ran, so the app crashed at
startup with 'Cannot read properties of undefined (reading setNative)'.
Move _ensureNativeTransforms into a leaf module (native-transforms)
imported by both files; it only touches WinRT types, so the edge from
animation back into the view module disappears. The public re-export
from ui/core/view is preserved.
nx-cloud
Bot
commented
Oct 23, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
View your CI Pipeline Execution ↗ for commit 8c98608
| Command |
Status |
Duration |
Result |
nx test apps-automated -c=android |
✅ Succeeded |
3m 51s |
View ↗ |
nx run-many --target=test --configuration=ci --... |
✅ Succeeded |
7s |
View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-10-23 20:42:48 UTC
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Open in StackBlitz
npm i https://pkg.pr.new/@nativescript/core@11581
npm i https://pkg.pr.new/@nativescript/vite@11581
npm i https://pkg.pr.new/@nativescript/webpack@11581
commit: 8c98608
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.