Skip to content

Instantly share code, notes, and snippets.

@lnhrdt
Last active September 16, 2016 14:57
Show Gist options
  • Save lnhrdt/e84a27248a1041af08f029647f392f05 to your computer and use it in GitHub Desktop.
Save lnhrdt/e84a27248a1041af08f029647f392f05 to your computer and use it in GitHub Desktop.
Webpack ENV setup
<form action="{{MY_URL}}/purchase" method="post">
</form>
import appTemplate from 'app.handlebars'
document.body.insertAdjacentHTML('afterbegin', appTemplate({
MY_URL: MY_URL
}));
module.exports = {
MY_URL: JSON.stringify('http://localhost:3000')
};
module.exports = {
MY_URL: JSON.stringify('http://backend.example.com')
};
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