Paul W
Paul W

Reputation: 114

Visual Studio 2017 and webpack issue

I installed VS 2017 with a working dot net core solution. Prior to installation I was able to run webpack and it would transpile all of my ts, html, etc. into one single main-client.js file. After installation it no longer was packing the html files for my angular 2 app and my webpack was showing all of the js files in the output.

I then removed the code off of my machine and pulled a fresh version from my git repo. I ran webpack before starting VS 2017 and running the migrations for the dot net core app. The webpack worked correctly again. Then I opened VS 2017 and it is now failing. Any suggestions would be greatly appreciated.

Upvotes: 3

Views: 6382

Answers (1)

Jeff M
Jeff M

Reputation: 171

Same problem -- dotnetcore / aspnetcore / angular application broke webpack when run in Visual Studio 2017.

Preventing .ts compilation fixed this for me. In the .csproj files first PropertyGroup add:

<PropertyGroup>
    . . . 
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
</PropertyGroup>

Then you'll need to delete all the .js and .js.map files in your ClientApp/app folder.

By default vs2017 autocompiles .ts file, producing .js and .js.map. Presumably, webpack was finding the .js files and then not processing the template .html files.

Upvotes: 12

Related Questions