EatTheBlocks Forum

DEX project rechart error (section 22)

Hi! Has anyone come across an issue on rechart? I’ve installed the npm package rechart version 2.0.0, and can’t compile. The message is:

./node_modules/recharts/es6/index.js"export 'Props' (reexported as 'AreaProps') was not found in './cartesian/Area'

Any idea? Thanks!

I found some solutions on google:

And one of the solution resolved the issue:

This is because the es6 compile folder’s index.js imports types that are not left in the actual files after compilation.

A temporary hack is to use the src folder directly for TypeScript, or the umd version for JS.

So instead of:

import { Area } from “recharts”;

JS users should use:

import * as Recharts from “recharts/umd/Recharts”;
const Area = Recharts.Area;

For us:

import { ResponsiveContainer, LineChart, Line, CartesianGrid, XAxis, YAxis } from ‘recharts/umd/Recharts’;

1 Like