react-simple-maps
react-simple-maps copied to clipboard
prop-types dependencies
This library requires prop-types dependency extracted from the built-in React v15.5.0.
Please include prop-types in project or remove the dependency so that users don't have to find dependencies.
I'm still having this issue with a clean install of vite and react-simple-maps. After installing prop-types, the below error was resolved.
✘ [ERROR] Could not resolve "prop-types"
node_modules/react-simple-maps/dist/index.es.js:2:22:
2 │ import PropTypes from 'prop-types';
╵ ~~~~~~~~~~~~
You can mark the path "prop-types" as external to exclude it from the bundle, which will remove
this error.
Reproduction
- Create a react project with
vite:
yarn create vite missing-dependency-example --template react-swc-ts && \
cd missing-dependency-example && \
yarn add [email protected] && \
yarn add @types/react-simple-maps && \
yarn install
- Replace
App.tsxwith the (slightly modified) example:
import React from 'react';
import { ComposableMap, Geographies, Geography } from 'react-simple-maps';
const geoUrl = "https://raw.githubusercontent.com/deldersveld/topojson/master/world-countries.json";
const MapChart = () => {
return (
<ComposableMap>
<Geographies geography={geoUrl}>
{({ geographies }) =>
geographies.map((geo) => (
<Geography key={geo.rsmKey} geography={geo} />
))
}
</Geographies>
</ComposableMap>
)
}
const App = () => {
return (
<React.Fragment>
<MapChart />
</React.Fragment>
)
}
export default App;
- Run to see error
yarn run dev