How can I have my
You've mentioned that webpack is being used, I'm assuming a different configuration is used for development and production.
You could try the html-webpack-plugin and set it up to inject the script in your
index.html file. This way the script will be injected into HTML based on the webpack output setup. You might have to adjust your config accordingly. If that doesn't work, the webpack-path-rewriter seems as an option too, but I haven't tried it yet.
Or you could write a small script that would determine the environment based on
document.location.hostname and then include a
<script> with correct src path. But this approach just doesn't seem right and is prone to changing domains.
But I would agree with what @Makyen, make environments the same. I assume the production one would be more difficult to change, so try to match that one with whatever you're doing in development.