{"action":"created","issue":{"url":"https://api.github.com/repos/insin/nwb/issues/456","repository_url":"https://api.github.com/repos/insin/nwb","labels_url":"https://api.github.com/repos/insin/nwb/issues/456/labels{/name}","comments_url":"https://api.github.com/repos/insin/nwb/issues/456/comments","events_url":"https://api.github.com/repos/insin/nwb/issues/456/events","html_url":"https://github.com/insin/nwb/issues/456","id":320590387,"node_id":"MDU6SXNzdWUzMjA1OTAzODc=","number":456,"title":"nwb build-web-module and env vars","user":{"login":"AquiGorka","id":3072458,"node_id":"MDQ6VXNlcjMwNzI0NTg=","avatar_url":"https://avatars3.githubusercontent.com/u/3072458?v=4","gravatar_id":"","url":"https://api.github.com/users/AquiGorka","html_url":"https://github.com/AquiGorka","followers_url":"https://api.github.com/users/AquiGorka/followers","following_url":"https://api.github.com/users/AquiGorka/following{/other_user}","gists_url":"https://api.github.com/users/AquiGorka/gists{/gist_id}","starred_url":"https://api.github.com/users/AquiGorka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AquiGorka/subscriptions","organizations_url":"https://api.github.com/users/AquiGorka/orgs","repos_url":"https://api.github.com/users/AquiGorka/repos","events_url":"https://api.github.com/users/AquiGorka/events{/privacy}","received_events_url":"https://api.github.com/users/AquiGorka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-06T12:54:33Z","updated_at":"2018-10-15T21:31:20Z","closed_at":null,"author_association":"NONE","body":"This issue is a: Question / support request\r\n\r\nGreat library and many thanks for all the work.\r\n\r\nI see you removed support for `env` variables [here](https://github.com/insin/nwb/commit/65a212f2c713f897ef6d434fbf8cdafc3a5631ad), is there any way to build a `web-module` that can use an `env` var?\r\n\r\nUse case:  a value for `dev` environment and a different one for `prod`."},"comment":{"url":"https://api.github.com/repos/insin/nwb/issues/comments/430020971","html_url":"https://github.com/insin/nwb/issues/456#issuecomment-430020971","issue_url":"https://api.github.com/repos/insin/nwb/issues/456","id":430020971,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDAyMDk3MQ==","user":{"login":"fc","id":20962,"node_id":"MDQ6VXNlcjIwOTYy","avatar_url":"https://avatars2.githubusercontent.com/u/20962?v=4","gravatar_id":"","url":"https://api.github.com/users/fc","html_url":"https://github.com/fc","followers_url":"https://api.github.com/users/fc/followers","following_url":"https://api.github.com/users/fc/following{/other_user}","gists_url":"https://api.github.com/users/fc/gists{/gist_id}","starred_url":"https://api.github.com/users/fc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fc/subscriptions","organizations_url":"https://api.github.com/users/fc/orgs","repos_url":"https://api.github.com/users/fc/repos","events_url":"https://api.github.com/users/fc/events{/privacy}","received_events_url":"https://api.github.com/users/fc/received_events","type":"User","site_admin":false},"created_at":"2018-10-15T21:31:20Z","updated_at":"2018-10-15T21:31:20Z","author_association":"NONE","body":"In your `nwb.config.js` file, use the `extra` option to add webpack's environment plugin:\r\n```\r\nconst webpack = require(\"webpack\");\r\n\r\nmodule.exports = {\r\n  type: \"react-component\",\r\n  npm: {\r\n    esModules: true,\r\n    umd: {\r\n      global: \"SomeApp\",\r\n      externals: {\r\n        react: \"React\"\r\n      }\r\n    }\r\n  },\r\n  webpack: {\r\n    extra: {\r\n      plugins: [\r\n        new webpack.EnvironmentPlugin({\r\n          BLAH: \"aha\"\r\n        })\r\n      ]\r\n    }\r\n  }\r\n};\r\n```\r\n\r\nIn the above example, access it as `process.env.BLAH`\r\n\r\nReference:\r\nhttps://github.com/insin/nwb/blob/master/docs/Configuration.md#extra-object\r\n\r\n\r\nIf you wanted to use `dotenv`, you could also use it like so (untested):\r\n```\r\nimport dotenv from 'dotenv';\r\n\r\n/* etc */\r\n\r\n    new webpack.EnvironmentPlugin({\r\n      ...dotenv.config().parsed\r\n    }),\r\n```"}}
{"actor":{"display_login":"fc"}}