tomchentw / react-google-maps

React.js Google Maps integration component
https://tomchentw.github.io/react-google-maps/
MIT License
4.62k stars 939 forks source link

yarn build:src fails #844

Open gergely-ujvari opened 6 years ago

gergely-ujvari commented 6 years ago

if trying to run yarn build:src, it fails, with the following error message:

$ yarn build:src
yarn run v1.7.0
$ babel-node src/tx/jscodeshift
Generating src/components/addons/MarkerWithLabel.jsx from src/macros/addons/MarkerWithLabel.jsx
TypeError: Invalid attempt to destructure non-iterable instance
    at /home/ujvari/git/01/react-google-maps/node_modules/babel-runtime/helpers/slicedToArray.js:48:13
    at contentToJS (/home/ujvari/git/01/react-google-maps/src/tx/ClassDefinition.js:26:46)
    at /home/ujvari/git/01/react-google-maps/src/tx/ClassDefinition.js:18:12
    at tryCatcher (/home/ujvari/git/01/react-google-maps/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/ujvari/git/01/react-google-maps/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/ujvari/git/01/react-google-maps/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/ujvari/git/01/react-google-maps/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/ujvari/git/01/react-google-maps/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/home/ujvari/git/01/react-google-maps/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/ujvari/git/01/react-google-maps/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/ujvari/git/01/react-google-maps/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)
    at process.topLevelDomainCallback (domain.js:121:23)
child_process.js:643
    throw err;
    ^

After a little debugging I realized, that what is happenning inside ClassDefinition.js that it downloads the html page from https://developers.google.com/maps/documentation/javascript/3.exp/reference and tries to parse it and fails.

This is most probable due to the fact that google changed the structure of that homepage. Basing the build on an outside html source was never a good way to be reliable.

jamesmosier commented 6 years ago

Did you find a way to fix this (even just temporarily) @gergely-ujvari ?

thzinc commented 5 years ago

I'm running into this as well. It appears that the Google Maps API docs changed formatting. Now details of classes are in their own pages, so ClassDefinition.js needs to be updated. I'm working through this issue, so I may be able to produce a PR shortly.

JustFly1984 commented 5 years ago

@thzinc look at our new project, which supports async react, etc. https://github.com/justfly1984/react-google-maps-api We are currently working on docs, etc. some of components is not done yet, but in general it is complete rewrite. And it does builds, and tree-shakable.

thzinc commented 5 years ago

I'm working on a fix for this in a fork. I'll PR upstream when I've passed a round of reviews by my engineering team. https://github.com/syncromatics/react-google-maps/pull/1

@JustFly1984 I'll take a look at your project, but I'm not quite ready to make a wholesale change to a new library. I have a significant codebase that is built around this package.

JustFly1984 commented 5 years ago

@thzinc welcome! Anyway You need to think about new React 16.7 support, when react 16.7 will be out of beta. Current version does not support async react. You can help us out by joining our project as maintainer if you are interested.