[code-infra] Fully resolve imports in ESM target
Stepping stone towards full ESM support. This babel plugin replaces imports with their full resolved path + extension.
./path/to/module becomes ./path/to/module.js or ./path/to/module/index.js, depending on where it resolves to.
See https://github.com/mui/material-ui/pull/43294
blocked on
- [x] merge https://github.com/mui/material-ui/pull/43294
- [x] replace csbci dependency
Deploy preview: https://deploy-preview-14234--material-ui-x.netlify.app/
Generated by :no_entry_sign: dangerJS against 2ef7f649a96705bb52a4912b3452deb4734f46aa
Tried out with the dataGrid through the csbci published packages and no issues found
@alexfauquette added you here cause you might have feedback based on #13608
For reference, the next steps are
- replace extension for esm modules with .mjs
- remove nested package.json files
- add exports field (this one likely will need to go on a semver major)
This pull request has conflicts, please resolve those before we can evaluate the pull request.
This pull request has conflicts, please resolve those before we can evaluate the pull request.
This pull request has conflicts, please resolve those before we can evaluate the pull request.
@JCQuintas @alexfauquette This PR doesn't touch the build process of @mui/x-charts-vendor. This package (so far) doesn't seem to have any relative imports in its ESM target. It looks like it's already ESM compliant.
This PR doesn't touch the build process of @mui/x-charts-vendor. This package (so far) doesn't seem to have any relative imports in its ESM target. It looks like it's already ESM compliant.
Just to be sure, "this PR does not touch the build process of @mui/x-charts-vendor" and "It looks like it's already ESM compliant" are not related.
- The PR does not impact the package because it is a dedicated babel config that is used in the build script
- Tt's already ESM compliant because ESM files are fairly simple
// `x-charts-vendor/d3-color` (ESM)
// See upstream license: https://github.com/d3/d3-color/blob/main/LICENSE
//
// Our ESM package uses the underlying installed dependencies of `node_modules/d3-color`
export * from "d3-color";
- Yes, the vendor package does its own build, what I add in this PR has no influence in it whatsoever.
- Yes, it has an exports field and all relative modules specifiers inside contain the file extension ("all" because there are none 😉)