React Leaflet maps has an issue when install first time & how I solved it.

Step 1: You need to install two packages using npm: 

npm install react-leaflet leaflet

Step 2

"browserslist" value should be replace with below code snippet:


"browserslist": [

  ">0.2%",

      "not dead",

      "not op_mini all"

    ]


If you don't do that then you'll encounter following error:


./node_modules/@react-leaflet/core/esm/path.js 10:41

Module parse failed: Unexpected token (10:41)

File was processed with these loaders:

 * ./node_modules/babel-loader/lib/index.js

You may need an additional loader to handle the result of these loaders.

|   useEffect(function updatePathOptions() {

|     if (props.pathOptions !== optionsRef.current) {

>       const options = props.pathOptions ?? {};

|       element.instance.setStyle(options);

|       optionsRef.current = options;


One additional changes must needed to prevent this error. Delete the .cache folder from node_modules



Post a Comment

0 Comments