MaximBalaganskiy / AureliaDotnetTemplate

Aurelia .Net Template
43 stars 14 forks source link

Webpack honours build type when publishing from Visual Studio #5

Closed PeterWone closed 5 years ago

PeterWone commented 5 years ago

As you are probably aware, Visual Studio can "Publish" which does a build and then uses msdeploy to put the output onto a webserver. It is possible to specify the build type (release or debug) interactively, and publishing respects this setting and produces appropriate binaries and any supporting resources.

Compilation and bundling is done by MSBUILD according to the content of the CSPROJ file. Unfortunately, whoever wrote the build target responsible for using Webpack failed to consider the type of build.

This change corrects this omission, specifying a dev flag to webpack when publishing a debug build, and a prod flag for release builds.

MaximBalaganskiy commented 5 years ago

You could just

        <Exec Command="npm run webpack:dev" Condition="'$(Configuration)' == 'Debug'" />
        <Exec Command="npm run webpack:prod" Condition="'$(Configuration)' == 'Release'" />

:)