{"action":"created","issue":{"url":"https://api.github.com/repos/electron/electron/issues/11309","repository_url":"https://api.github.com/repos/electron/electron","labels_url":"https://api.github.com/repos/electron/electron/issues/11309/labels{/name}","comments_url":"https://api.github.com/repos/electron/electron/issues/11309/comments","events_url":"https://api.github.com/repos/electron/electron/issues/11309/events","html_url":"https://github.com/electron/electron/issues/11309","id":278515165,"number":11309,"title":"Am I missing how to perform a conditional build?","user":{"login":"fmarzocca","id":8530030,"avatar_url":"https://avatars1.githubusercontent.com/u/8530030?v=4","gravatar_id":"","url":"https://api.github.com/users/fmarzocca","html_url":"https://github.com/fmarzocca","followers_url":"https://api.github.com/users/fmarzocca/followers","following_url":"https://api.github.com/users/fmarzocca/following{/other_user}","gists_url":"https://api.github.com/users/fmarzocca/gists{/gist_id}","starred_url":"https://api.github.com/users/fmarzocca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fmarzocca/subscriptions","organizations_url":"https://api.github.com/users/fmarzocca/orgs","repos_url":"https://api.github.com/users/fmarzocca/repos","events_url":"https://api.github.com/users/fmarzocca/events{/privacy}","received_events_url":"https://api.github.com/users/fmarzocca/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-01T16:09:55Z","updated_at":"2017-12-01T16:09:57Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nIn my app I have several code snippets which I need to \"polish\" before packaging for production (i.e.: web urls, devtools, debug logs, etc). This is becoming a long and annoying exercise and everytime I risk to forget something.\r\n\r\nI have tried cross-env, but it is useful only in development to test how tha app will perform in production. I can do this in package.json:\r\n\r\n```\r\n \"scripts\": {\r\n    \"start\": \"cross-env NODE_ENV=development electron .\",\r\n    \"start-prod\": \"cross-env NODE_ENV=production electron .\",\r\n```\r\n\r\nand check this is my app scripts:\r\n\r\n```\r\nif (process.env.NODE_ENV === \"production\") {\r\n\t$webview.src=\"https://<production.url>\";\r\n} else {\r\n\t$webview.src=\"https://<development-url>\";\r\n}\r\n```\r\n\r\nThis is working fine, but cross-env doesn't work with electron-packager. I have tried this:\r\n\r\n`\"package-mac\": \"cross-env NODE_ENV=production electron-packager . --overwrite --platform=darwin --arch=x64 --icon=icons/icon.icns --prune=true --out=release-builds\",`\r\n\r\nbut `NODE_ENV` is undefined after the packaging, so it is not a solution.\r\n\r\nFor sure, I am missing something here, as it should be a way to have a conditional build without scrolling the whole code...! :-)\r\n\r\n\r\n* Electron version: 1.7.9\r\n* Operating system: Mac OSX 10.13.1\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/electron/electron/issues/comments/348535473","html_url":"https://github.com/electron/electron/issues/11309#issuecomment-348535473","issue_url":"https://api.github.com/repos/electron/electron/issues/11309","id":348535473,"user":{"login":"welcome[bot]","id":30606887,"avatar_url":"https://avatars0.githubusercontent.com/in/4141?v=4","gravatar_id":"","url":"https://api.github.com/users/welcome%5Bbot%5D","html_url":"https://github.com/apps/welcome","followers_url":"https://api.github.com/users/welcome%5Bbot%5D/followers","following_url":"https://api.github.com/users/welcome%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/welcome%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/welcome%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/welcome%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/welcome%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/welcome%5Bbot%5D/repos","events_url":"https://api.github.com/users/welcome%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/welcome%5Bbot%5D/received_events","type":"Bot","site_admin":false},"created_at":"2017-12-01T16:09:57Z","updated_at":"2017-12-01T16:09:57Z","author_association":"NONE","body":"👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.\n\nTo help make it easier for us to investigate your issue, please follow the [contributing guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md#submitting-issues).\n"}}
{"actor":{"display_login":"welcome"}}