Add @vite-ignore to dynamic imports to silence Vite/Rollup warnings#409
Open
prawnsgupta wants to merge 1 commit into
Open
Add @vite-ignore to dynamic imports to silence Vite/Rollup warnings#409prawnsgupta wants to merge 1 commit into
prawnsgupta wants to merge 1 commit into
Conversation
Bundlers based on Vite/Rollup (e.g. Angular 17+ dev server) emit 'The above dynamic import cannot be analyzed by Vite' warnings for the runtime-URL dynamic imports in core.mjs and HierarchyPainter.mjs. Adding the /* @vite-ignore */ comment (alongside the existing /* webpackIgnore: true */) tells Vite these imports are intentionally dynamic, as recommended by the warning itself. No behavior change. Seen downstream in HSF/phoenix#902.
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.
When JSROOT is bundled by Vite/Rollup-based tooling (e.g. the Angular 17+ dev server), the runtime-URL dynamic imports produce warnings like:
These imports (in
injectCode,loadModules,loadScriptinmodules/core.mjs, and the module loader inmodules/gui/HierarchyPainter.mjs) are intentionally dynamic — the URL is only known at runtime — which is exactly the case the/* @vite-ignore */comment exists for. This PR adds it alongside the existing/* webpackIgnore: true */comment; the two coexist and each bundler reads its own.No behavior change:
node -e "import('./modules/core.mjs')"loads fine, and the comments are ignored by browsers/Node.Reported downstream by the Phoenix event display (HSF/phoenix#902), which consumes jsroot through Angular's Vite-based builder.
Also added a line to
changes.md.