chartjs / chartjs/Chart.js

PieController requires LinearScale in webpack production mode

Open
#11,157 2 comments 1 reaction 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### Expected behavior

Either the application bundled in production mode doesn't require `LinearScale`, or `LinearScale` is required in development mode, too.

According to the [documentation](https://www.chartjs.org/docs/4.2.1/getting-started/integration.html#bundle-optimization), I think that `Chart.js` is intended to not require `LinearScale`.

### Current behavior

During runtime of a Chart.js-Application, which doesn't include `LinearScale`, bundled in webpack's production mode, I get an _Uncaught ReferenceError: LinearScaleBase not defined_:

grafik

### Reproducible sample

https://github.com/chkpnt/chartjs-issue11157/blob/main/App.js#L3-L9

### Optional extra steps/info to reproduce

Starting the application with `npm run start`(which uses webpack's development mode) works, while `npm run start-prod` isn't working. In order to get the application to work in production mode, `LinearScale` needs to be included in the bundle.

### Possible solution

_No response_

### Context

_No response_

### chart.js version

v4.2.1

### Browser name and version

Firefox 110.0

### Link to your project

https://github.com/chkpnt/chartjs-issue11157

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.