mapbox / mapbox/mapbox-gl-directions

NODE_ENV is undefined, triggers console error in production

Open
#273 7 comments 5 reactions 0 assignees View on GitHub
auto-triaged bug
Dominant language
JavaScript
Stars
255
Forks
130
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the warning with create-react-app and webpack >=4, then inspect mapbox-gl-directions.js around lines 5413 and 5436 to trace the differing NODE_ENV values. Compare the production build configuration with the Redux warning behavior. Done means production use no longer logs this NODE_ENV error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, webpack
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.