Last active
September 16, 2016 14:57
-
-
Save lnhrdt/e84a27248a1041af08f029647f392f05 to your computer and use it in GitHub Desktop.
Webpack ENV setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import appTemplate from 'app.handlebars' | |
document.body.insertAdjacentHTML('afterbegin', appTemplate({ | |
MY_URL: MY_URL | |
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
MY_URL: JSON.stringify('http://localhost:3000') | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
MY_URL: JSON.stringify('http://backend.example.com') | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack'); | |
const path = require('path'); | |
const config = (env) => { | |
return { | |
more_stuff: 'things', | |
plugins: [ | |
new webpack.DefinePlugin(require(path.join(__dirname, env))) | |
] | |
} | |
}; | |
module.exports = config(process.env.NODE_ENV || 'local'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment