I'm building a React app with webpack and typescript. I'm using the dependency react-financial-charts, and it's specified correctly in package.json and there's the following two folders inside node_modules: @react_financial_charts and react_financial_charts.
However, when I use the library in my code and compile, I get the following error.
ERROR in ./node_modules/@react-financial-charts/utils/lib/index.js 2:0-27
Module not found: Error: Can't resolve './withSize' in 'C:\Users\Username\project\node_modules\@react-financial-charts\utils\lib'
Did you mean 'withSize.js'?
I checked the folder described in this error message, and it contains the file withSize.js. What gives?
My webpack.config.js contains this:
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
My index.tsx contains:
import React from "react";
import ReactDOM from "react-dom";
import Chart from "./StockChart"
ReactDOM.render(<Chart />, document.getElementById("root"));
Where StockChart.tsx resides in the same directory and is copy-pasted from:
https://github.com/reactivemarkets/react-financial-charts/blob/master/packages/stories/src/features/StockChart.tsx
I set up the React+Webpack+Typescript project following these instructions (note that I later added the react-financial-charts dependency after following these instructions):