mapbox / mapbox-gl-directions

Directions plugin for mapbox-gl-js using Mapbox Directions API.
https://mapbox.com/mapbox-gl-js/example/mapbox-gl-directions/
ISC License
235 stars 124 forks source link

NODE_ENV is undefined, triggers console error in production #273

Open dafnarosenblum opened 3 years ago

dafnarosenblum commented 3 years ago

create-react-app with webpack >=4, I'm getting: You are currently using minified code outside of NODE_ENV === 'production'. This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) to ensure you have the correct code for your production build. From mapbox-gl-directions.js:5436 in production. Adding process.env.NODE_ENV to the string in line 5413 results with printing undefined. Adding process.env.NODE_ENV to the console.error in line 5436 results with printing 'production'. I was wondering if there is a way to avoid this error in the log. Thanks.

GabrielMassaroFHNW commented 3 years ago

@dafnarosenblum is there an update on this issue. I have the same problem when using @mapbox/mapbox-gl-directions 4.1.0 in create-react-app. Even setting NODE_ENV=production on my production machine doesn't resolve this issue.

mikeomeara1 commented 2 years ago

This is also true for Angular applications and I too have been unable to find a way to solve this. Anyone have any suggestions?

FinnLawrence commented 2 years ago

Reporting this since we installed mapbox-gl-directions (4.1.0) in our React app too. Webpack 5.35.1 and React 17.0.2.

Tried a bunch of things with how our webpack builds run and no fix found so far.

jeroenburgers commented 2 years ago

We have the same console error in our production code. We used mapbox-gl-directions (4.1.0). It does not matter what application it is (Angular, React, Vue of whatever).

ndaaktan commented 2 years ago

I have same console error. I'm using mapbox-gl-directions v4.1.0. I think, I can't draw line, point and polygon with using draw tools because of console error

tonviet712 commented 5 months ago

Same problem. I'm using mapbox-gl-directions@4.1.1 I built an app by Laravel, Webpack, Vue