Open TripleJBlog opened 2 years ago
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.
vite
:
yarn create vite missing-dependency-example --template react-swc-ts && \
cd missing-dependency-example && \
yarn add react-simple-maps@3.0.0 && \
yarn add @types/react-simple-maps && \
yarn install
App.tsx
with 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 (
) }
const App = () => { return (
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.