Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Issue number: resolves #31333
What is the current behavior?
Currently, Stencil's lazy loader resolves component bundles with a template literal dynamic import wrapped in a
/* @vite-ignore */comment. Vite 8 moved dependency prebundling from esbuild to Rolldown, which honors that comment and leaves the import alone, so the.entry.jschunks never get emitted into the prebundle output. Requests for them 404 and no lazy component registers, which surfaces asConstructor for "ion-app#undefined" was not foundin the console.Angular CLI 22.1 is where most people hit this, since its dev server is the first to ship Vite 8. It only affects the lazy
IonicModulepath, because that's the only thing in the repo that pulls@ionic/core/loader. Standalone components import from@ionic/core/componentsand never touch the loader.What is the new behavior?
With this change we set
extras.enableImportInjectionincore/stencil.config.ts. Stencil prepends a switch of literal import paths to the loader, ahead of the existing@vite-ignoreimport, so Rolldown can resolve each bundle and emit its chunk. The original import stays as the fallback, so nothing changes for consumers that already worked.The fix is one config flag that would silently revert if anyone dropped it, so there's a guard alongside it.
core/scripts/verify/lazy-imports.jsreads the builtdist/esmanddist/cjs, locates the loader chunk, and fails if any bundle is missing a literal import. It runs in bothbuild-coreandbuild-core-stencil-prerelease, so a Stencil upgrade that changes the injection behavior fails the nightly rather than shipping.Does this introduce a breaking change?
Other information
Verified against a stock Angular CLI 22.1 app using
IonicModule.forRoot()and a local build of this branch. Before the fix we had a ton of 404s onion-app_8.entry.jsandion-button_2.entry.js, plus someConstructor for ... was not founderrors. After the fix we had no console errors, components render fine, andng buildemits the entry chunks with the right names.CI doesn't cover the actual symptom and it cannot here because we have no ng22 test apps on main, but we'll have it tested for free on major-9.0 with the existing ng22 test app there. The guard script asserts the build-output invariant for the extra validation.
The injected switch adds roughly 10.8 KB raw to the lazy runtime chunk, which is under 1 KB gzipped because the case clauses are near-identical repeated text, but people using the CDN build will have no extra overhead at all.
Anyone on a published
@ionic/corecan work around this withprebundle.excludeinangular.jsonuntil it ships: