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

[next] esm build not in dist #246

Closed
hsablonniere opened this issue May 20, 2021 · 9 comments
Closed

[next] esm build not in dist #246

hsablonniere opened this issue May 20, 2021 · 9 comments

Comments

@hsablonniere
Copy link

hsablonniere commented May 20, 2021

Hi team,

I'm migrating from chart.js v2 to v3 and I'm looking forward to have good ESM and treeshaking support.
I've been using this plugin so I tried the 2.0.0-rc.

It works but my the ESM file referenced in the package.json is not in my node_modules after installation.

This means my rollup configuration:

  • picks up the default CJS file in dist
  • which does a require('chart.js')
  • which imports the whole lib
  • and thus prevents treeshaking

I may be mistaken but I think the rollup config is in conflict here: https://github.com/chartjs/chartjs-plugin-datalabels/blob/next/rollup.config.js#L48

How can I help?

@hsablonniere
Copy link
Author

I just cloned the project, I can prepare a PR if you want ;-)

Capture d’écran_2021-05-20_15-28-30

@hsablonniere
Copy link
Author

I was still on master. Sorry.

@hsablonniere
Copy link
Author

The build correctly generates the esm file.

@hsablonniere
Copy link
Author

It's weird because the package.json is OK and the npm pack --dry-run has the ESM file.

Capture d’écran_2021-05-20_15-33-15

@simonbrunel simonbrunel added this to the Version 2.0 milestone May 20, 2021
@simonbrunel
Copy link
Member

simonbrunel commented May 20, 2021

Thanks @hsablonniere! The .esm.js file is missing in the attach-gh-assets.js and create-release-tag.js scripts.

@hsablonniere
Copy link
Author

@simonbrunel Ah ok. I looked at some scripts but not those...

Thanks for your work and the plugin in general ;-)

We use it in our components library: https://www.clever-cloud.com/doc/clever-components/?path=/story/%F0%9F%9B%A0-overview-cc-tile-requests--default-story

@hsablonniere
Copy link
Author

Do you want a PR?

@simonbrunel
Copy link
Member

This is fixed by 0870ebe, released in v2.0.0-rc.1.

The ESM build is now correctly:

@hsablonniere
Copy link
Author

You are awesome, thanks very much Simon 😍👍👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants