GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(vite): keep re-exports in order when hoisting HMR imports by triniwiz · Pull Request #11571 · NativeScript/NativeScript

Conversation

@triniwiz

@triniwiz triniwiz commented Oct 23, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

PR Checklist

  • The PR title follows the commit guidelines.
  • There is an issue for this bug.
  • CLA status verified.
  • All existing tests pass locally (see note below).
  • Tests for the changes are included.

What is the current behavior?

Two /ns/m passes, hoistTopLevelStaticImports and ensureNativeScriptModuleBindings, move import declarations to the top of a served module but leave export ... from declarations in place. ESM evaluates module requests in source order, so this changes the order dependencies are evaluated in.

It breaks packages whose barrel re-exports modules before a side-effect import that leads back into the barrel. MasonKit's index.windows.js does:

export { Scroll } from './scroll';
export * from './web';
import './html-windows'; // imports ./web, which does `class BlockElement extends Scroll`

The served module starts with import ".../html-windows.js", so web.js evaluates before ./scroll, and the HMR boot fails with Cannot access 'Scroll' before initialization. Webpack and Vite's own transform keep the source order, so the app works in both.

What is the new behavior?

Both passes now move export ... from and export * from declarations along with the imports and keep their source order. Modules without re-exports are served exactly as before.

Adds regression tests for both passes. Each fails before the fix and passes after it.

Validation: on a Vue + MasonKit app (Windows target), I fetched the served /ns/m graph and simulated ESM evaluation order. Before the fix, web.js evaluates before scroll/index.windows.js; after it, scroll evaluates first. The full packages/vite vitest run on feat/windows passes except resolveFsAnchoredSpec returns the path actually found, which fails on that branch without this change too. Not yet verified with a device boot.

Related: triniwiz/nativescript-mason#163 removes the cycle on the MasonKit side.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@triniwiz
fix(vite): keep re-exports in order when hoisting HMR imports
1a8a081
Hoisting only import declarations moved them above export-from ones, changing module evaluation order and causing TDZ errors in plugins with re-export cycles.
@nx-cloud

nx-cloud Bot commented Oct 23, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 1a8a081

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 3m 28s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-23 07:40:50 UTC

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11571
npm i https://pkg.pr.new/@nativescript/vite@11571
npm i https://pkg.pr.new/@nativescript/webpack@11571

commit: 1a8a081

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@triniwiz triniwiz mentioned this pull request Oct 23, 2026
fix: import web.ts views from their modules, not the package index triniwiz/nativescript-mason#163
Merged

This branch has not been deployed

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

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.

1 participant

@triniwiz
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.