How to inject different config values inside of my app.js file for things like URLs?

javascript
webpack

#1

When a user clicks on a button I want to redirect to a URL, but this URL has to be read from my config since it varies between DEV and PROD environments.

Is this possible to do with webpack somehow?

$("#btn-hero").click(function(){
  console.log('clicked...');
  window.location.href = 'http://localhost:4000/accounts/new';
  return false;
});

#2

Can’t you use data-attributes to save the URL?


#3

Oh I see what your saying, that’s one approach yes thanks.