How to use webpack in ASP.Net Core project in Visual Studio for Mac

451 views Asked by At

As title, is it possible to use webpack through Task Runner to automatically bundle (and minify) all dependency script files in Visual Studio for Mac, just like we can do that in Visual Studio 2017 for Windows.

If so, and how?

1

There are 1 answers

0
Matt Ward On

Visual Studio for Mac does not currently have a Task Runner Explorer window. What you can do instead is create a custom command.

Right click the project in the Solution window and select Options to open the Project Options dialog. Then go to the Build - Custom Commands section.

Custom Commands - Project Options

Here you can create a command that will be run on certain project events and can replace existing actions such as the Build itself:

  • Before Build
  • Build
  • After Build
  • Before Clean
  • Clean
  • After Clean
  • Custom Command

So you could have webpack run before every build. Or perhaps you want to do this manually every so often. If so you can select the Custom Command in the drop down list. This will then add a new menu option when you right click the project in the Solution window which will run that command.