Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

flint-chart/react fails to build without every optional backend installed (dynamic imports of chart.js / plotly.js-dist-min)

Open
#155 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
chart.js, next.js, react, typescript
Domain
frontend, web-dev

Research direction

Start by tracing the dynamic imports in flint-chart/react and flint-chart/interactive, including the backend entry points named in the issue. Check how optional peer dependencies are declared and how the package is built with a backend peer missing. Done means consumers can build with only their chosen backend installed, or the README documents a reliable workaround.

Written by the indexing model from the issue text.

Description

flint-chart/react (and flint-chart/interactive) reach every interactive backend through dynamic imports:

import('../chartjs/interactive')   // imports 'chart.js'
import('../plotly/interactive')    // imports 'plotly.js-dist-min'
import('../echarts/interactive')   // imports 'echarts'
import('../vegalite/interactive')

chart.js, plotly.js-dist-min and echarts are optional peer dependencies (peerDependenciesMeta), so an app that only renders one backend leaves the others uninstalled. But bundlers resolve dynamic imports at build time, so the build fails even though those modules would never load.

Reproduce

flint-chart 1.0.1, Next.js 16 (Turbopack), with vega, vega-lite, vega-tooltip and echarts installed but not chart.js or Plotly:

import { FlintChart } from "flint-chart/react";

<FlintChart spec={spec} backend="vegalite" />
Module not found: Can't resolve 'chart.js'
./node_modules/flint-chart/dist/chartjs/interactive.js (1:1)
> 1 | import { Chart, registerables } from 'chart.js';

The same happens for plotly.js-dist-min. The workaround is aliasing the missing packages to a stub (turbopack.resolveAlias / webpack resolve.alias), which every consumer has to rediscover.

Possible fixes

  • Let the host pass the backend's interactive renderer in, e.g. <FlintChart renderer={createVegaLiteInteractiveRenderer()} /> (or a flint-chart/react/vegalite entry), so only the imported backend is bundled.
  • Or mark the optional-backend imports so bundlers skip them (/* webpackIgnore: true */ / /* @vite-ignore */ with a runtime-resolved specifier), and document installing the peer for the backend you use.
  • At least document the alias workaround next to "Interactive charts" in the README.
Dominant language
TypeScript
Stars
4.4k
Forks
256
Avg merge
1d 16h
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/flint-chart

All issues in microsoft/flint-chart

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.