Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging a client-side Blazor project into a single JS file #37732

Closed
anthony-c-martin opened this issue Oct 21, 2021 · 7 comments
Closed

Packaging a client-side Blazor project into a single JS file #37732

anthony-c-martin opened this issue Oct 21, 2021 · 7 comments
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved

Comments

@anthony-c-martin
Copy link
Member

Is your feature request related to a problem? Please describe.

My team owns a VSCode extension, which interacts with a Language Server written in C# (https://github.com/Azure/bicep) to provide interactive language features. We have a demo playground, which leverages Blazor to host the C# code in-browser.

With the recently-announced VSCode.dev project, our extension is currently unsupported as it requires dotnet runtime to run the language server. It would be amazing if we could bundle our full language server and run it in-browser for the web version of VSCode. As far as I can tell, the main blocker here would be the requirement to bundle all extension JS into a single file.

Is anyone aware of a way of either generating a single JS file at publish time (including all DLLs, plus necessary framework dependencies), or utilizing a tool like webpack to package the full Blazor output into a single JS file?

Describe the solution you'd like

A mechanism to bundle client-side Blazor code into a single JS file.

@mkArtakMSFT mkArtakMSFT added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Oct 21, 2021
@javiercn
Copy link
Member

@anthony-c-martin thanks for contacting us.

As part of 6.0 we are shipping the ability to completely customize Blazor deployments. It's very likely you can leverage that to create a single JS file with all the necessary info. You can read more details about it here

If you have more questions feel free to reach out.

@anthony-c-martin
Copy link
Member Author

Very cool, thank you for sharing! I'll give that sample a go.

@Thaina
Copy link

Thaina commented Nov 5, 2021

Are there already exist the way to setup and write blazor and C# in vscode.dev ? If not then is there any progress or stuck?

@javiercn
Copy link
Member

javiercn commented Nov 5, 2021

Hi.

It looks like you are posting on a closed issue!

We're very likely to lose track of your bug/feedback/question unless you:

  1. Open a new issue
  2. Explain very clearly what you need help with
  3. If you think you have found a bug, include detailed repro steps so that we can investigate the problem

@elringus
Copy link

elringus commented Nov 5, 2021

Are there already exist the way to setup and write blazor and C# in vscode.dev ? If not then is there any progress or stuck?

Afaik, there is none and it's not even planned: #37910 (comment)

The PR that resolves one of the blocking issues has been moved to 7.0 milestone: dotnet/runtime#54640

I have the same needs and am currently experimenting with 6.0 branch trying to compile WASM runtime as a single-file js UMD library, which can be used in vscode. Will notify here if it'll get me anywhere.

@Thaina
Copy link

Thaina commented Nov 5, 2021

Thank you very much for your infos. I would hope this would possible soon

@elringus
Copy link

As promised, here is the solution: https://github.com/Elringus/DotNetJS

It allows compiling a C# project into single-file UMD library, which can be consumed in any JavaScript environment, including VS Code's web extensions. Here is a sample extension, that works both in desktop and web versions of VS Code: https://github.com/Elringus/DotNetJS/tree/main/Examples/WebExtension

@ghost ghost locked as resolved and limited conversation to collaborators Dec 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved
Projects
None yet
Development

No branches or pull requests

5 participants