From ChartJS v4.1.0 onwards, they have moved to a ECMAScript only module approach (see https://www.chartjs.org/docs/4.4.6/migration/v4-migration.html#general) which means that you have to compile your application to ECMAScript module as well when using ChartJS v4.1.0 or above. See the links below for help on how to do that
package.json
and if you are building a wrapper library around ChartJS and then importing that wrapper library into another application using Webpack v5 then you need to disable the Webpack configuration that forces mandatory extension in ESM module imports by setting resolve.fullySpecified
to false
(see https://webpack.js.org/configuration/module/#resolvefullyspecified for more details).