diff --git a/netlify.toml b/netlify.toml index 2bddf111c..ccab57772 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,4 +2,4 @@ NPM_FLAGS = "--version" # prevent Netlify npm install [build] publish = "website/build" - command = "npx pnpm i --store=node_modules/.pnpm-store && npx pnpm add -D ./website --store=node_modules/.pnpm-store && cd website && npx pnpm build" + command = "npx pnpm i --store=node_modules/.pnpm-store && cd website && npx pnpm i --store=node_modules/.pnpm-store && npx pnpm build" diff --git a/website/docs/faq/docs.js b/website/docs/faq/docs.js index a57cdac73..c5b9eeca6 100644 --- a/website/docs/faq/docs.js +++ b/website/docs/faq/docs.js @@ -16,4 +16,12 @@ exports.docs = [ title: 'Why is a background fill not working?', slug: '/faq/fill-property', }, + { + title: 'How to fix "... is not a registered element" error?', + slug: '/faq/registered-element', + }, + { + title: 'How to fix "... is not a registered scale" error?', + slug: '/faq/registered-scale', + }, ]; diff --git a/website/docs/faq/registered-element.md b/website/docs/faq/registered-element.md new file mode 100644 index 000000000..dabc538cc --- /dev/null +++ b/website/docs/faq/registered-element.md @@ -0,0 +1,19 @@ +--- +slug: /faq/registered-element +--- + +# How to fix "... is not a registered element" error? + +As you can see in [migration to v4 guide](/docs/migration-to-v4#tree-shaking): + +> v4 of this library, [just like Chart.js v3](https://www.chartjs.org/docs/latest/getting-started/v3-migration.html#setup-and-installation), is tree-shakable. It means that you need to import and register the controllers, elements, scales, and plugins you want to use. +> +> For a list of all the available items to import, see [Chart.js docs](https://www.chartjs.org/docs/latest/getting-started/integration.html#bundlers-webpack-rollup-etc). + +So you should register missed components. For example, if you have `Uncaught Error: "arc" is not a registered element.` error, you should register `ArcElement`: + +```js +import { ArcElement } from "chart.js"; + +ChartJS.register(ArcElement); +``` diff --git a/website/docs/faq/registered-scale.md b/website/docs/faq/registered-scale.md new file mode 100644 index 000000000..453af3c4d --- /dev/null +++ b/website/docs/faq/registered-scale.md @@ -0,0 +1,19 @@ +--- +slug: /faq/registered-scale +--- + +# How to fix "... is not a registered scale" error? + +As you can see in [migration to v4 guide](/docs/migration-to-v4#tree-shaking): + +> v4 of this library, [just like Chart.js v3](https://www.chartjs.org/docs/latest/getting-started/v3-migration.html#setup-and-installation), is tree-shakable. It means that you need to import and register the controllers, elements, scales, and plugins you want to use. +> +> For a list of all the available items to import, see [Chart.js docs](https://www.chartjs.org/docs/latest/getting-started/integration.html#bundlers-webpack-rollup-etc). + +So you should register missed components. For example, if you have `Uncaught Error: "category" is not a registered scale.` error, you should register `CategoryScale`: + +```js +import { CategoryScale } from "chart.js"; + +ChartJS.register(CategoryScale); +```