{"action":"created","issue":{"url":"https://api.github.com/repos/wlx200510/webpack4.x-learn/issues/2","repository_url":"https://api.github.com/repos/wlx200510/webpack4.x-learn","labels_url":"https://api.github.com/repos/wlx200510/webpack4.x-learn/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/wlx200510/webpack4.x-learn/issues/2/comments","events_url":"https://api.github.com/repos/wlx200510/webpack4.x-learn/issues/2/events","html_url":"https://github.com/wlx200510/webpack4.x-learn/issues/2","id":330907806,"node_id":"MDU6SXNzdWUzMzA5MDc4MDY=","number":2,"title":"process.env.NODE_ENV有误，始终是undefind","user":{"login":"zrnokia5230","id":25945398,"node_id":"MDQ6VXNlcjI1OTQ1Mzk4","avatar_url":"https://avatars3.githubusercontent.com/u/25945398?v=4","gravatar_id":"","url":"https://api.github.com/users/zrnokia5230","html_url":"https://github.com/zrnokia5230","followers_url":"https://api.github.com/users/zrnokia5230/followers","following_url":"https://api.github.com/users/zrnokia5230/following{/other_user}","gists_url":"https://api.github.com/users/zrnokia5230/gists{/gist_id}","starred_url":"https://api.github.com/users/zrnokia5230/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zrnokia5230/subscriptions","organizations_url":"https://api.github.com/users/zrnokia5230/orgs","repos_url":"https://api.github.com/users/zrnokia5230/repos","events_url":"https://api.github.com/users/zrnokia5230/events{/privacy}","received_events_url":"https://api.github.com/users/zrnokia5230/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-06-09T18:07:12Z","updated_at":"2018-06-10T06:46:25Z","closed_at":null,"author_association":"NONE","body":"--mode 只能保证 process.env.NODE_ENV在src中的js中获取到值\r\n并不是node环境  所以函数中根据process.env.NODE_ENV来判断资源路径是有问题的\r\n想要在webpack的配置中获取到process.env.NODE_ENV\r\n需要用到\"cross-env\": \"^5.1.3\",\r\n并配置\r\n \"build\": \"cross-env NODE_ENV='production' webpack --config build/webpack.prod.config.js --mode production\",\r\n    \"dev\": \"cross-env NODE_ENV='development' webpack-dev-server --open --config build/webpack.dev.config.js --mode development\",\r\n\r\n这样整个node环境的环境变量才会变"},"comment":{"url":"https://api.github.com/repos/wlx200510/webpack4.x-learn/issues/comments/396025138","html_url":"https://github.com/wlx200510/webpack4.x-learn/issues/2#issuecomment-396025138","issue_url":"https://api.github.com/repos/wlx200510/webpack4.x-learn/issues/2","id":396025138,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjAyNTEzOA==","user":{"login":"wlx200510","id":18573498,"node_id":"MDQ6VXNlcjE4NTczNDk4","avatar_url":"https://avatars2.githubusercontent.com/u/18573498?v=4","gravatar_id":"","url":"https://api.github.com/users/wlx200510","html_url":"https://github.com/wlx200510","followers_url":"https://api.github.com/users/wlx200510/followers","following_url":"https://api.github.com/users/wlx200510/following{/other_user}","gists_url":"https://api.github.com/users/wlx200510/gists{/gist_id}","starred_url":"https://api.github.com/users/wlx200510/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wlx200510/subscriptions","organizations_url":"https://api.github.com/users/wlx200510/orgs","repos_url":"https://api.github.com/users/wlx200510/repos","events_url":"https://api.github.com/users/wlx200510/events{/privacy}","received_events_url":"https://api.github.com/users/wlx200510/received_events","type":"User","site_admin":false},"created_at":"2018-06-10T06:46:25Z","updated_at":"2018-06-10T06:46:25Z","author_association":"OWNER","body":"至于获取多个入口的方法，不是本教程的重点，如果是对`webpack`配置有足够了解之后，针对自己的项目可以进行更加灵活的改动，而并非直接作出一个完美无缺的框架供大家使用，所以这种多入口的方法可以放在`issue`中，但不合并到教程中。"}}
{"actor":{"display_login":"wlx200510"}}