Skip to content

Commit

Permalink
using different env str in different environment
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaszhu2zgf committed Aug 23, 2017
1 parent 709a254 commit 2ab8d94
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/pages/home/home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Home extends Component{
render() {
return (
<div>
<h1 className="warn">this is home page</h1>
<h1 className="warn">this is home page 哈哈哈哈</h1>
<img src={logoImage}/>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion app/utils/httpBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let httpProcessor = function(method, url, data){
url: url,
data: data || null,
method: method,
baseURL: 'https://some-domain.com/api/',
baseURL: HTTP_BASE_URL,
timeout: 10000
// withCredentials: true
};
Expand Down
5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ module.exports = {
]
},
plugins: [
new webpack.DefinePlugin({
HTTP_BASE_URL: JSON.stringify('https://www.test-domain.com/api/')
}),
new HtmlWebpackPlugin({template: 'app/index.html'}),
new webpack.HotModuleReplacementPlugin()
new webpack.HotModuleReplacementPlugin(),
]
};
3 changes: 2 additions & 1 deletion webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ module.exports = {
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
},
HTTP_BASE_URL: JSON.stringify('https://www.domain.com/api/')
}),
// uglify js files
new webpack.optimize.UglifyJsPlugin({
Expand Down

0 comments on commit 2ab8d94

Please sign in to comment.