Skip to content
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

[Feature] Support native ESM explicitly in package.json #16599

Closed
snake-poison opened this issue Mar 1, 2022 · 1 comment
Closed

[Feature] Support native ESM explicitly in package.json #16599

snake-poison opened this issue Mar 1, 2022 · 1 comment
Labels
en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature.

Comments

@snake-poison
Copy link

What problem does this feature solve?

Looks like the space and standards are moving towards ESM, it'd be cool if this library embraced that by switching to a package.json that embraces the latest best practices in multi-format support.

See:
Additional context about this issue:

What does the proposed API look like?

package.json would include the type and exports options:

  "type": "module",
  "exports": {
    ".": {
      "require": "./dist/echarts.js",
      "import": "./dist/echarts.esm.js",
      "types": "./index.d.ts"
    },
    "./core": {
      "import": "./core.js",
      "types": "./core.d.ts"
    },
    "./renderers": {
      "import": "./renderers.js",
      "types": "./renderers.d.ts"
    },
    "./charts": {
      "import": "./charts.js",
      "types": "./charts.d.ts"
    },
    "./components": {
      "import": "./components.js",
      "types": "./components.d.ts"
    },
     "./features": {
      "import": "./features.js",
      "types": "./features.d.ts"
    }
  },
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Mar 1, 2022
@snake-poison
Copy link
Author

The suggestion here would break cjs builds. Closing this as that is probably not a good idea....

I will come back with a PR to update the build process to create .mjs and .cjs files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

No branches or pull requests

1 participant