I'm trying to load different javascript files based on which environment I'm using. I have created an Angular2 application, which lives inside a MVC app.
In my index.html (_layout.cshtml), I have the following scripts:
<script src="~/public/lib/js/vendors.min.js"></script> <!--bundled dependencies-->
@*<script src="~/public/dist/js/app.min.js"></script> <!--bundled source-->*@
<script src="~/system.dev.config.js"></script>
<script>
System.import('../public/dist/AppComponent/main.js').catch(function (err) { console.error(err); });
</script>
This code will load angular2 dependencies and start the application. I want to distinguish between development (when I'm developing on the application) and when it's online in production.
I want to distinguish, so I only load the following files:
Dev environment:
<script src="~/public/lib/js/vendors.min.js"></script> <!--bundled dependencies-->
<script src="~/system.dev.config.js"></script>
<script>
System.import('../public/dist/AppComponent/main.js').catch(function (err) { console.error(err); });
</script>
Prod environment:
<script src="~/public/lib/js/vendors.min.js"></script> <!--bundled dependencies-->
<script src="~/public/dist/js/app.min.js"></script> <!--bundled source-->
Is there any option, so when I am in debug mode it should use the dev scripts and the other way around when in release mode?
Thanks in advance.