[core-docs] Use type-only imports for type-only references#48386
Merged
JCQuintas merged 4 commits intomui:masterfrom Apr 30, 2026
Merged
[core-docs] Use type-only imports for type-only references#48386JCQuintas merged 4 commits intomui:masterfrom
JCQuintas merged 4 commits intomui:masterfrom
Conversation
Vite 8 uses Rolldown for production builds, which is stricter than Rollup about value-imports referencing names that have no runtime export. Several files import types like Theme, ThemeOptions, SxProps as value-imports from @mui/material/styles or @mui/system; Rolldown then fails with "X is not exported by ..." because those names exist only in declaration files. Add the inline `type` modifier (or use `import type`) so the imports are erased at compile time and never reach the bundler.
Bundle size
Deploy previewhttps://deploy-preview-48386--material-ui.netlify.app/ Check out the code infra dashboard for more information about this PR. |
Member
|
Time to make this a company wide setting? |
Member
Author
|
Up to you, might anger some ppl 😆 |
mui/mui-public#1357 makes consistent-type-imports always-on in the shared base config, so the per-package override here would become redundant once material-ui bumps @mui/internal-code-infra.
Member
Author
|
Moved to mui/mui-public#1357 — making it the default in the shared config so it covers every consumer. |
Janpot
approved these changes
Apr 30, 2026
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.
Summary
Vite 8 uses Rolldown (instead of Rollup) for production builds. Rolldown is stricter than Rollup about value-imports that reference names with no runtime export — it fails the build with a
MISSING_EXPORTerror.Several files in
@mui/internal-core-docsimport types such asTheme,ThemeOptions,SxPropsfrom@mui/material/stylesand@mui/systemas plain (value) imports. Babel happens to keep some of those at compile time, and they then reach the bundler. With Rollup this was fine; with Rolldown the bundle fails:This was hit while bundling MUI X regression tests with vite 8 (mui/mui-x#22260).
Changes
Convert all type-only references in
packages-internal/core-docs/src/**to use the inlinetypemodifier (orimport type) so they are erased at compile time and never reach the bundler.The per-package ESLint override was moved to mui/mui-public#1357 so the rule applies to every consumer.