-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
feat: add ESM support #10525
feat: add ESM support #10525
Conversation
I think this PR also resolves this issue #9436 If we still want to support commonjs, cjs bundle from this PR has compatible with ESM exports:
@benmccann What do you think? |
I'd love to drop CJS and do ESM-only if possible |
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 not sure how the files should be named, because I guess chart.js can't be UMD when type='module'
.
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.
Just one more comment (considering all of the package.json's)
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.
Needs a rebase though
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.
Something about this should be mentioned in https://www.chartjs.org/docs/master/migration/v4-migration.html but I don't want to hold because of that.
I will resolve conflicts later today |
Should we keep the unminified UMD build? It might help people if they encounter an error in the minified build or otherwise want to debug. Perhaps we should have a |
@benmccann maybe just emit sourcemaps for UMD bundle ? |
Alternative of #10479
More changes than expected, but still.
To import CommonJS modules in/from ESM project
.cjs
extension is required.