mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-08 21:29:07 +02:00
ed2b96eeaf
* Initial work * Update doc commands * Updated sidebar config * Move docs * Update theme version and enable * Convert to chart.js sample * Update scripts to point to local build * Chart.js from local build * Simplify getting-started example * Axis docs updated except for imported content * Common ticks import works * Chart type docs ported to editor plugin * Last pages to use editor * Fix small errors * Frontmatter title to heading * Remove duplicate example * Update sidebar * Add paths * Remove paths * Add getting-started back * Update menus and add copyright to license section of the docs * Add GA plugin * Style sub-groups * Remove unneeded license page since it is covered on the main page * Remove docusaurus readme page * Remove docusaurus files * Fix issues in docs * Build and deploy scripts for docs work * Conditional base URL for nice local testing * Use eslint-plugin-markdown * Remove hard coded lines * Remove mentions of docusaurus Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
38 lines
1.1 KiB
Markdown
38 lines
1.1 KiB
Markdown
# Publishing an extension
|
|
|
|
If you are planning on publishing an extension for Chart.js, here are a some pointers.
|
|
|
|
## Awesome
|
|
|
|
You'd probably want your extension to be listed in the [awesome](https://github.com/chartjs/awesome).
|
|
|
|
Note the minimum extension age requirement of 30 days.
|
|
|
|
## ESM
|
|
|
|
If you are utilizing ESM, you probably still want to publish an UMD bundle of your extension. Because Chart.js v3 is tree shakeable, the interface is a bit different.
|
|
UMD package's global `Chart` includes everything, while ESM package exports all the things separately.
|
|
Fortunately, most of the exports can be mapped automatically by the bundlers.
|
|
|
|
But not the helpers.
|
|
|
|
In UMD, helpers are available through `Chart.helpers`. In ESM, they are imported from `chart.js/helpers`.
|
|
|
|
For example `import {isNullOrUndef} from 'chart.js/helpers'` is available at `Chart.helpers.isNullOrUndef` for UMD.
|
|
|
|
### Rollup
|
|
|
|
`output.globals` can be used to convert the helpers.
|
|
|
|
```js
|
|
module.exports = {
|
|
// ...
|
|
output: {
|
|
globals: {
|
|
'chart.js': 'Chart',
|
|
'chart.js/helpers': 'Chart.helpers'
|
|
}
|
|
}
|
|
};
|
|
```
|