chartjs / chartjs/Chart.js

Chart.js does not work without transpilations as an ES / JS module due to non-relative @kurkle/color imports

Open
#11,889 1 comment 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

i was looking at your lib again and i am actually very impressed that you are using relative import paths in a way that browsers can understand.

now i wanted to import your lib inside a JS module based canvas worker without transpilations to provide you with an example of having multi window charts which can directly communicate.

i made this work with changing the 3 "broken" (non relative) kurkle imports:
https://github.com/neomjs/chartjs-demo/commit/0b7d7c1f3761fb5bccfa9279de847ea280634659

![Screenshot 2024-08-31 at 13 32 43](https://github.com/user-attachments/assets/f2a820bc-962e-4bed-9d64-55b3caccea92)

while the hotfix candidate has (needs) the assumption, that the chart.js and kurkle node_modules are at the same level, it does work now. so it would be very much appreciated in case you can apply it to your code base.

### Current behavior

without the fix inside the 3 spots, we get:
![Screenshot 2024-08-31 at 13 34 43](https://github.com/user-attachments/assets/90196972-f503-455a-8b38-aa49ca8da060)

### Reproducible sample

https://github.com/neomjs/chartjs-demo

### Optional extra steps/info to reproduce

_No response_

### Possible solution

_No response_

### Context

current repo to create the multi-window demo with your lib:
https://github.com/neomjs/chartjs-demo

based on:
https://github.com/neomjs/neo

### chart.js version

v4.4.4

### Browser name and version

Chrome, FF, Safari

### Link to your project

https://github.com/neomjs/chartjs-demo

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.