mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[code-infra] Fully resolve imports in ESM target

Open Janpot opened this issue 1 year ago • 7 comments

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

Janpot avatar Aug 16 '24 12:08 Janpot

Deploy preview: https://deploy-preview-14234--material-ui-x.netlify.app/

Generated by :no_entry_sign: dangerJS against 2ef7f649a96705bb52a4912b3452deb4734f46aa

mui-bot avatar Aug 16 '24 13:08 mui-bot

Tried out with the dataGrid through the csbci published packages and no issues found

Janpot avatar Aug 19 '24 15:08 Janpot

@alexfauquette added you here cause you might have feedback based on #13608

JCQuintas avatar Aug 19 '24 15:08 JCQuintas

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)

Janpot avatar Aug 19 '24 15:08 Janpot

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Aug 21 '24 10:08 github-actions[bot]

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Aug 21 '24 16:08 github-actions[bot]

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Aug 26 '24 08:08 github-actions[bot]

@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.

Janpot avatar Aug 29 '24 09:08 Janpot

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.

  1. The PR does not impact the package because it is a dedicated babel config that is used in the build script
  2. 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";

alexfauquette avatar Aug 29 '24 13:08 alexfauquette

  1. Yes, the vendor package does its own build, what I add in this PR has no influence in it whatsoever.
  2. Yes, it has an exports field and all relative modules specifiers inside contain the file extension ("all" because there are none 😉)

Janpot avatar Aug 29 '24 14:08 Janpot