You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chore(admin): singleton module handling for vite aliases - #27046
Forces CodeMirror-related packages to resolve as a single runtime instance in the admin Vite graph.
Adds ADMIN_VITE_SINGLETON_MODULES (@codemirror/*, @uiw/react-codemirror) separate from admin-pinned alias modules
Why is it needed?
CodeMirror extensions use instanceof checks. When the admin bundler loads more than one physical @codemirror/state (common in monorepo / yarn / yalc graphs where design-system and hoisted @codemirror/lang-json resolve different copies), JSONInput fails with:
Unrecognized extension value in extension set ([object Object]).
This sometimes happens because multiple instances of @codemirror/state are loaded, breaking e2e test
How to test it?
From repo root, run the unit tests covering the change:
yarn nx test @strapi/strapi --testPathPattern='admin-vite-aliases|resolve-development-config'
Merge into e.g #26713 and see that the e2e tests pass
Verdict: request changes — one production-code issue before merge.
Blocker: hard getModulePathFrom('@strapi/design-system', …) for packages DS does not declare
buildAdminViteResolveAliases maps every ADMIN_VITE_SINGLETON_MODULES entry through getModulePathFrom('@strapi/design-system', mod) with no fallback.
DS 2.2.3 only declares @codemirror/state, @codemirror/view, @codemirror/lang-json, and @uiw/react-codemirror. The list also includes @codemirror/language, @codemirror/commands, and @codemirror/lint.
On pnpm-strict / nested graphs, those three are typically only reachable under @uiw/react-codemirror's own node_modules, not via Node resolution from the DS package root. resolve-from then throws and admin Vite config never builds.
Only DS-resolve what DS declares (state, view, lang-json, @uiw/react-codemirror); resolve the rest from admin/cwd with fallback.
Narrow the list to the packages that actually need the DS copy for instanceof (mainly state / view / uiw).
The singleton approach (alias + dedupe + optimizeDeps.include) is fine — this is just making the resolve path resilient.
Non-blocking
Add ADMIN_VITE_SINGLETON_MODULES to PINNED_OPTIMIZE_MODULES in admin-vite-optimize-exclude.ts so plugin auto-exclude cannot pull CodeMirror off the include/dedupe path.
Set a milestone (check-pr-status is failing without one).
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
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.
What does it do?
Forces CodeMirror-related packages to resolve as a single runtime instance in the admin Vite graph.
ADMIN_VITE_SINGLETON_MODULES(@codemirror/*,@uiw/react-codemirror) separate from admin-pinned alias modulesWhy is it needed?
CodeMirror extensions use
instanceofchecks. When the admin bundler loads more than one physical@codemirror/state(common in monorepo / yarn / yalc graphs where design-system and hoisted@codemirror/lang-jsonresolve different copies), JSONInput fails with:How to test it?
From repo root, run the unit tests covering the change:
yarn nx test @strapi/strapi --testPathPattern='admin-vite-aliases|resolve-development-config'
Merge into e.g #26713 and see that the e2e tests pass