Search code examples
visual-studio-2015bundlebundling-and-minificationweb-essentials

Automatically rebuild Javascript Bundles on debug start


I am using Web Essentials within Visual Studio 2015 to manage bundling my JavaScript files together.

(Almost) everything is working fine.. I have my bundleconfig.json file in the root of my project, and when I right-click on it and choose "update bundles" it does exactly that.

The created files are exactly where I want them to be, and contain exactly what I want them to contain.

However...
The bundles only ever seem to get updated one of two ways:

  1. I make and save a significant change to the bundleconfig.json file. (eg: I add a new script file)
  2. I right-click on the bundleconfig.json file and choose "update bundles".

This is becoming quite an annoying shortfall, as if I make a small change to a single JS file, then hit F5 to start the project, the bundles wouldn't not have been rebuilt, and I won't see the change appear in the running application.

Whilst I'm aware I can simply manually rebuild the bundles before I run the project each and every time, it's quite easy to forget, then spend ages debugging a problem you've actually fixed!

I've spent ages trawling through the help for Web Essentials in vein and can't find a similar question here on SO...

Does anyone know how to force the rebuilding of the bundles each and every time I start debugging a project (perhaps on each build?)


Solution

  • I found this solution works for me:

    right-click the file "bundleconfig.json" and select enable bundle on build...

    I had to do it again after adding som new js files, and now it's working again.