-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[code-infra] Move next config to ESM #40869
Conversation
Netlify deploy previewhttps://deploy-preview-40869--material-ui.netlify.app/ Bundle size report |
import withDocsInfra from './nextConfigDocsInfra.js'; | ||
import { findPages } from './src/modules/utils/find.mjs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about this. Why add the extensions?
Edit: oh lol really? https://nodejs.org/api/esm.html#mandatory-file-extensions
Mandatory file extensions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node.js follows the native browser implementation in its resolver for esm, full paths mandatory. I guess it guarantees predictable amount of io access during module loading? It's more important on the web.
I think I saw somewhere that they're porting the classic node resolver to esm, but it's still experimental.
We're having modules that are loaded both by the app and the config file (e.g.
docs/config
). This change allows us to author them in ESM for both environments. I'm having trouble loading thedocs/config
when moving it into@mui/docs