I’m building a Blazor WebAssembly app and deploying it to Azure Static Web Apps using GitHub Actions. My app relies on JavaScript files generated from TypeScript with gulp task, which places them in the wwwroot/scripts folder. Locally, everything works fine, but in the GitHub Actions pipeline, the scripts folder is missing from the final publish output.
Here’s my setup:Github workflow job
- uses: actions/checkout@v4 with: submodules: true - name: Deploy to Azure Static Web Apps id: builddeploy uses: Azure/static-web-apps-deploy@v1 env: ENABLE_MULTIPLATFORM_BUILD: true with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }} action: "upload" app_location: "AppLocation" output_location: "wwwroot" app_build_command: "dotnet publish -c Release"gulpfile.js
var paths = { entries: ["./Components/Canvas2D/Canvas2d.ts"], output: "./wwwroot/scripts",};gulp.task("default", function () { return gulp .src(paths.entries) .pipe( esbuild({ outdir: "/", bundle: true, target: "es2015", format: "esm", sourcemap: true, minify: true, }) ) .pipe(gulp.dest(paths.output));});package.json has build instruction
"scripts": {"build": "gulp default"}In the logs I see that the gulp task is executed
> gulp default[11:57:58] Using gulpfile /github/workspace/AppLocation/gulpfile.js[11:57:58] Starting 'default'...[11:57:59] Finished 'default' after 96 msBut it is missing in the published app.
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: error loading dynamically imported module: https://blazorapp.fun/scripts/Canvas2d.jsUpdate:I build my app locally with act action runnergulp task runner successfully but I do not find the output files in the destination folder.The gulp task works correctly, but there are problems when I run it with the GitHub workflow
