Lately, I’ve been working to integrate a client-side build process to a project at work. The idea is that I would like to be able to transpile my TypeScript files through webpack and include them in my published solution.
I added my webpack build command to the pre-build commands section in my web project and thought that I would be good to go. Nope.
I ran into a road block. Build artifacts (like my output folder that webpack puts all of the transpiled files into) don’t automatically get pushed out on publish of the web project.
After a long while testing out ideas to no avail, I finally found a solution.
If you add this target near the end of your web.csproj file, it’ll add your output directory to your published solution. (note: TypeScriptCompiledToJS was my output directory that I wished to get pushed to the published output. You could change that in this solution to whatever name you need.)
<Message Text=”Copy Typescript Files” Importance=”high” />
<_CustomFiles Include=”$(ProjectDir)\TypeScriptCompiledToJS\**\*” />