Repository navigation
fix(design-system): externalizar @mui/* y @emotion/* por prefijo (1.4.1, crash MUI >= 9.1) - #20
Merged
Merged
Conversation
El crash con @mui/material >= 9.1 ("Cannot read properties of undefined
(reading 'reducedMotion')") venia de que vite.config.ts externalizaba
@mui/material y @mui/icons-material solo por nombre exacto: los subpaths
(@mui/material/styles, @mui/icons-material/<X>, @emotion/*) quedaban
bundleados en dist/, incluido @mui/styled-engine de la version instalada al
compilar. Ahora external usa /^@mui\//, /^@emotion\//, react, react-dom,
react/jsx-runtime, react-router-dom y react-helmet-async.
- dist/index.js 447437 -> 288021 bytes; dist/index.cjs 281886 -> 173642.
- scripts/verify-externals.mjs + npm run verify-externals + paso en ci.yml.
- Version 1.4.1, CHANGELOG.md nuevo, docs corregidas (no era el minificador).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015nTgTv7S3gQwaoNFw5fZeG
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.
Qué hace
Parche
@ai4u/design-system1.4.1: corrige el crash con@mui/material>= 9.1 externalizando MUI/Emotion/React por prefijo.Alcance: afecta al paquete compartido, es decir a los 34 consumidores del design-system, en todos los tenants. No cambia API, tokens, breakpoints, textos, colores ni peer deps.
Causa raíz
packages/design-system/vite.config.ts(rollupOptions.external) externalizaba@mui/material,@mui/icons-material,@emotion/*solo por nombre exacto. Los subpaths (@mui/material/stylesx14,@mui/material/CssBaseline,@mui/icons-material/<X>x~20,@emotion/*) se bundleaban endist/index.jscon el@mui/styled-enginede la versión instalada al compilar. El tagsistemaDiseno#v1.4.0empotró styled-engine 9.0.0 (sintheme.motion); elTouchRipplede MUI >= 9.1 leetheme.motion.reducedMotiony revienta.Fix
external:/^@mui\//,/^@emotion\//,react,react-dom,react/jsx-runtime,react-router-dom,react-helmet-async.dist/reconstruido y commiteado.scripts/verify-externals.mjs+npm run verify-externals+ paso enci.ymltras el Build: falla sidist/bundlea código de MUI/Emotion/React o importa algo fuera de los externals. Sin navegador ni dependencias.packages/design-system/CHANGELOG.mdnuevo (con nota retroactiva de 1.4.0), docs corregidas (README raíz y CLAUDE.md decían "por el minificador": no era eso).Evidencia (smoke con react-dom/client + jsdom:
ThemeProvider+Buttondel DS,mousedown/mouseup; proyecto fuera del repo, React 18)v1.4.0(antes)reading 'reducedMotion'mainprevio (sin externalizar)distdemainprevio no crashea en el smoke, pero sigue bundleando MUI (frágil, atado a la versión de compilación); el crash reproducido es el del tag publicado.dist/index.js447 437 -> 288 021 bytes;dist/index.cjs281 886 -> 173 642.dist/styles/*.cssse siguen copiando.verify-externalsfalla contra el dist demainprevio y contra el tag 1.4.0, y pasa con el nuevo (36 imports@mui/*externos, 0 bundleado).dist/.npm ci && npm run type-check && npm test && npm run buildOK (161 tests de platform/etc.),git diff --quiet -- packages/*/distlimpio.NO verificado
index.js), no el.cjs; solo React 18 y MUI 9.0.1/9.2.0/9.5.0 (no 9.1.x ni 8/6, pese a peer>=6).distentre mi máquina y el runner es esperable pero no demostrado).test(los 7 tests jest no corren); fuera de alcance.Qué NO se hizo
MUI_BREAKPOINTS, textos >= 12px,buttonSm>= 44px, etc.).Pasos humanos tras el merge
design-system-v1.4.1conscripts/release.sh(no reutilizar 1.4.0).🤖 Generated with Claude Code
https://claude.ai/code/session_015nTgTv7S3gQwaoNFw5fZeG