diff --git a/src/chart.tsx b/src/chart.ts
similarity index 87%
rename from src/chart.tsx
rename to src/chart.ts
index e62ffba36..9ef620525 100644
--- a/src/chart.tsx
+++ b/src/chart.ts
@@ -3,6 +3,7 @@ import type {
DefaultDataPoint
} from 'chart.js'
import {
+ createElement,
useEffect,
useRef,
forwardRef
@@ -117,16 +118,18 @@ function ChartComponent<
return () => destroyChart()
}, [])
- return (
-
+ // createElement instead of JSX: strict ES module resolution, as in Node.js and webpack 5,
+ // cannot find `react/jsx-runtime` in React 16 and 17, which have no `exports` field (#1319)
+ return createElement(
+ 'canvas',
+ {
+ ref: canvasRef,
+ role: 'img',
+ height,
+ width,
+ ...canvasProps
+ },
+ fallbackContent
)
}
diff --git a/src/typedCharts.tsx b/src/typedCharts.ts
similarity index 90%
rename from src/typedCharts.tsx
rename to src/typedCharts.ts
index 0924f7c73..95bf8c8e3 100644
--- a/src/typedCharts.tsx
+++ b/src/typedCharts.ts
@@ -2,7 +2,10 @@ import type {
ChartType,
ChartComponentLike
} from 'chart.js'
-import { forwardRef } from 'react'
+import {
+ createElement,
+ forwardRef
+} from 'react'
import {
Chart as ChartJS,
LineController,
@@ -28,13 +31,11 @@ function createTypedChart(
ChartJS.register(registerables)
return /* @__PURE__ */ forwardRef, Omit, 'type'>>(
- (props, ref) => (
-
- )
+ (props, ref) => createElement(Chart, {
+ ...props,
+ ref,
+ type
+ })
) as TypedChartComponent
}
diff --git a/website/src/components/PropsTable.astro b/website/src/components/PropsTable.astro
index 614553bd9..959156722 100644
--- a/website/src/components/PropsTable.astro
+++ b/website/src/components/PropsTable.astro
@@ -23,8 +23,8 @@ function getDocs() {
// Standard