I've just started a brand new project using create-react-app
and set up react-leaflet
as their documentation recommends here.
I am trying to use this example to check if it's all working good but then I'm receiving the 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/react-scripts/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;
Looks like react-scripts
can't handle react-leaflet
files.
Can someone helps me to understand why it's happening and how do I fix it ?