node 先後端 process.env 共享

http://stackoverflow.com/questions/28717819/environment-variables-in-an-isomorphic-js-app-webpack-find-replace?rq=1webpack

 

plugins: [
    new DefinePlugin({
      'process.env': Object.keys(process.env).reduce(function(o, k) {
        o[k] = JSON.stringify(process.env[k]);
        return o;
      }, {})
    })
]
相關文章
相關標籤/搜索