I want to debug typescript in a MAUI Blazor app, but I am not able to do that with Visual Studio 2022 or F12 developer tools (Edge).
I am just able to debug Javascript code in F12 developer tools...
Does anybody know if it is possible to set breakpoints in Typescript in a MAUI Blazor app?
If you use a Blazor Server App it is working... but not in MAUI Blazor App...
Pre-Configuration:
Install Extension "Web compiler 2022+" in Visual Studio 2022 (Extensions => Manage extensions and install it) and restart it
Sample-App
I created a sample app:
https://github.com/reinhardlackner/SampleMauiBlazorTypescript
Steps:
- Create new MAUI Blazor app (.net 7)
- Add NuGet-Package "Microsoft.TypeScript.MSBuild"
- Add tsconfig file
- Add Typescript-File "test1.ts" in wwwroot-folder -> js-File + js.map-File is generated...
- Add test1.js - Reference in index.html
- Add button in Index.razor which calls TypeScript-Function:
Execute app (Windows Machine) - Alert is shown (OK):
Now I want to debug the method "sayHello", which was created in TypeScript.
- Setting a breakpoint in Visual Studio does not work:
- In the browser (F12 developer tools") test1.js is visible in Sources... but not the js.map or the ts-file:
- Setting a breakpoint in the JavaScript-File in the F12 developer tools browser would work:
But I want to work with TypeScript and to set Breakpoints in TypeScript-Files. JavaScript-Debugging is not an option because in this case I am not able to write complex debuggable TypeScript-Code when it's just possible to debug generated JavaScript-Code.
Is there any option to debug the TypeScript file directly?