Azure deploy – Angular 2 webpack 1.12.14 project that came with ASP.NET Core + Angular 2 template for Visual Studio.
We have been having issues publishing the Angular 2 webpack 1.12.14 project that came with ASP.NET Core + Angular 2 template for Visual Studio.
Make sure you have “webpack-node-externals”: “^1.4.3” in the package.json
finally got it to work by adding the following setting s to .csproj file
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> <Exec Command="dotnet bundle" /> <Exec Command="npm install" /> <Exec Command="webpack --config webpack.config.vendor.js --env.prod" /> <Exec Command="webpack --env.prod" /> </Target>
Now, as soon as you publish your site (well we don’t have CI for the dev and UAT due to costs, we just publish from our local) from Visual Studio,
- it builds .net code
- install npm packges
- build webpack with prod(.ts Prod NOT .NET prod) settings – we dotn have special settings on SPA , just debug and Prod. Prod will not have any map files
That’s is it.