Repository navigation
Conversation
Hoisting only import declarations moved them above export-from ones, changing module evaluation order and causing TDZ errors in plugins with re-export cycles.
|
View your CI Pipeline Execution ↗ for commit 1a8a081
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
This branch has not been deployed
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.
PR Checklist
What is the current behavior?
Two
/ns/mpasses,hoistTopLevelStaticImportsandensureNativeScriptModuleBindings, moveimportdeclarations to the top of a served module but leaveexport ... fromdeclarations 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.jsdoes:The served module starts with
import ".../html-windows.js", soweb.jsevaluates before./scroll, and the HMR boot fails withCannot 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 ... fromandexport * fromdeclarations 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/mgraph and simulated ESM evaluation order. Before the fix,web.jsevaluates beforescroll/index.windows.js; after it,scrollevaluates first. The fullpackages/vitevitest run onfeat/windowspasses exceptresolveFsAnchoredSpec 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.