importing DrawingManager from tomchentw/react-google-maps fails for create-react-app

380 views Asked by At

In an app created via create-react-app using

import DrawingManager from "react-google-maps/src/lib/drawing/DrawingManager";

will fail with the error message

Module parse failed: /.../react-google-maps-test/node_modules/react-google-maps/src/lib/drawing/DrawingManager.js Unexpected token (77:4)
You may need an appropriate loader to handle this file type.
| 
|   propTypes: {
|     ...controlledPropTypes,
|     ...defaultUncontrolledPropTypes,
|   },

Since create-react-app uses a strictely defined build-process I have little influence on the features used. Object spread is supported by the app.

Is this an issue on the tomchentw/react-google-maps or on the react-google-maps side? Can I get this running without ejecting?

(I am asking this question corresponding to an issue on SO as requested in the repo.)

1

There are 1 answers

3
sudo bangbang On BEST ANSWER

Googling this, I ended up in this issue. It suggests to do the following

import DrawingManager from 'react-google-maps/lib/drawing/DrawingManager'