I have a ASP.NET Core webapp, that builds frontend code using webpack. Webpack is called via npm, which in turn is called via the scripts section in my project.json:
{
...
"scripts": {
"postcompile": "npm run build"
}
}
The "npm run build" call sets the process exit code to 1 if the build fails. Nevertheless running "dotnet build" either from the command line or from Visual Studio does not fail - it prints the npm errors, but it does not fail the build.
How can I configure an additional build step like calling "npm run build" in my project.json file that will actually fail the build if the step fails?
Make sure that you set the
bail
property totrue
in webpack config if the errors is from the webpack buildFrom the docs: