{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/7032","repository_url":"https://api.github.com/repos/facebook/react","labels_url":"https://api.github.com/repos/facebook/react/issues/7032/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/7032/comments","events_url":"https://api.github.com/repos/facebook/react/issues/7032/events","html_url":"https://github.com/facebook/react/issues/7032","id":160011633,"number":7032,"title":"ReactPerf throws production is not defined error","user":{"login":"iroy2000","id":487520,"avatar_url":"https://avatars.githubusercontent.com/u/487520?v=3","gravatar_id":"","url":"https://api.github.com/users/iroy2000","html_url":"https://github.com/iroy2000","followers_url":"https://api.github.com/users/iroy2000/followers","following_url":"https://api.github.com/users/iroy2000/following{/other_user}","gists_url":"https://api.github.com/users/iroy2000/gists{/gist_id}","starred_url":"https://api.github.com/users/iroy2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iroy2000/subscriptions","organizations_url":"https://api.github.com/users/iroy2000/orgs","repos_url":"https://api.github.com/users/iroy2000/repos","events_url":"https://api.github.com/users/iroy2000/events{/privacy}","received_events_url":"https://api.github.com/users/iroy2000/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-13T18:11:51Z","updated_at":"2016-06-13T18:21:20Z","closed_at":"2016-06-13T18:21:20Z","body":"I'm using webpack to build my react project ( \"react\": \"^0.14.6\" ), and somehow it is throwing production is not defined ( ReferenceError ) in ReactPerf.    Because in my webpack setting, I was injecting the NODE_ENV ( which was working fine before ), any advice on that ?\r\n\r\n![screen shot 2016-06-13 at 11 11 05 am](https://cloud.githubusercontent.com/assets/487520/16018124/ddd1da32-3157-11e6-84ea-78e1ee1ec54b.png)\r\n\r\n![screen shot 2016-06-13 at 11 11 05 am]\r\n(https://cloud.githubusercontent.com/assets/487520/16018095/be628a98-3157-11e6-86dc-0cb09abd7bb9.png)"},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/225665435","html_url":"https://github.com/facebook/react/issues/7032#issuecomment-225665435","issue_url":"https://api.github.com/repos/facebook/react/issues/7032","id":225665435,"user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"created_at":"2016-06-13T18:21:20Z","updated_at":"2016-06-13T18:21:20Z","body":"`DefinePlugin` just substitutes what you specify as the value. You are specifying `'production'`, so it embeds the contents of the string (`production`) in your code, and it blows up. The correct configuration for that key is `NODE_ENV: \"'production'\"` (notice the apostrophes inside the quotes!) This way you Webpack will put a JS string in your code, and it will work.\r\n\r\nYou’ll notice that most example configurations use `{ NODE_ENV: JSON.stringify('production') }`. This is exactly the reason why they’re doing it. `JSON.stringify('production')` becomes a string containing `\"production\"`. But you can specify it in the raw `'\"production\"'` or `\"'production'\"` form if you’d like.\r\n\r\n**TLDR:** Replace `NODE_ENV: \"production\"` with `NODE_ENV: \"'production'\"` in your config."}}
{"actor":{"display_login":"gaearon"}}