shukerullah / react-geocode

A React module to transform a description of a location (i.e. street address, town name, etc.) into geographic coordinates (i.e. latitude and longitude) and vice versa.
MIT License
207 stars 35 forks source link

Deploying to Heroku #2

Closed olee2002 closed 6 years ago

olee2002 commented 6 years ago

First of all, thanks for this amazing package. It works really well in my localhost but I do get an error message when I try to push the app to Heroku. Could you take a look at this issue? I am trying to use your package for my final project which is due on this Friday so it would be nice if this can be resolved soon. If not, unfortunately, I would have to find another one. As long as your time is allowed.

http://bit.ly/2tRViJ9


remote:
remote:        ./node_modules/react-geocode/index.js:8
remote:
remote:        Read more here: http://bit.ly/2tRViJ9```

and below is the message from the Heroku link.
npm run build fails to minify
Some third-party packages don't compile their code to ES5 before publishing to npm. This often causes problems in the ecosystem because neither browsers (except for most modern versions) nor some tools currently support all ES6 features. We recommend to publish code on npm as ES5 at least for a few more years.

To resolve this:
Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.
Note: Create React App can consume both CommonJS and ES modules. For Node.js compatibility, it is recommended that the main entry point is CommonJS. However, they can optionally provide an ES module entry point with the module field in package.json. Note that even if a library provides an ES Modules version, it should still precompile other ES6 features to ES5 if it intends to support older browsers.
Fork the package and publish a corrected version yourself.

If the dependency is small enough, copy it to your src/ folder and treat it as application code.

In the future, we might start automatically compiling incompatible third-party modules, but it is not currently supported. This approach would also slow down the production builds.
shukerullah commented 6 years ago

I will fix by tomorrow. Thank you for raising this issue.

shukerullah commented 6 years ago

I have updated package, you may test it now.

olee2002 commented 6 years ago

The issue is still persisting. I wonder why? at least it changed the line of the issue from 8 to 29.

remote: Creating an optimized production build... remote: Failed to compile. remote: remote: Failed to minify the code from this file: remote: remote: ./node_modules/react-geocode/lib/index.js:29 remote: remote: Read more here: http://bit.ly/2tRViJ9 remote: remote: npm ERR! code ELIFECYCLE remote: npm ERR! errno 1 remote: npm ERR! client@0.1.0 build: react-scripts build remote: npm ERR! Exit status 1 remote: npm ERR! remote: npm ERR! Failed at the client@0.1.0 build script.

ryancoughlin commented 6 years ago

I am getting this same thing on Netlify:

5:28:17 PM: Failed to compile.
5:28:18 PM: Failed to minify the code from this file:
5:28:18 PM:     ./node_modules/react-geocode/lib/index.js:29
5:28:18 PM: Read more here: http://bit.ly/2tRViJ9
5:28:18 PM: error Command failed with exit code 1.
shukerullah commented 6 years ago

@ryancoughlin can you please try 0.0.7? Let me know if its works at your end.

ryancoughlin commented 6 years ago

Same result here.

Was just looking at this: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#resolving-heroku-deployment-errors

Appreciate your help.

g-wozniak commented 6 years ago

It still doesn't work unfortunately. Tried that today. On both Heroku and local environment it isn't possible to build a solution from create-react-app with this package.

Failed to minify the code from this file: ./node_modules/react-geocode/lib/index.js:2 Read more here: http://bit.ly/2tRViJ9

shukerullah commented 6 years ago

I have updated this lib to v0.1.2 and tested with create-react-app's "react-scripts build" command. Please update to latest version.