Publish blazor.*.js files to npm
See original GitHub issueI’m working on implementing some server-side Blazor components, but I have a lot of other Javascript functionality on the page. I would like to be able to include the needed blazor.server.js file in my webpack build process, instead of having to embed it directly on the page. This way all of the Javascript for my application gets included in one file.
I would like to be able to bundle blazor.server.js into my webpack build, by either accessing it through NPM or being able to link to it directly. However, according to aspnet/AspNetCore.Docs#12358 this is an embedded resource in the middleware, so I’m not sure how I can access it and include it in my build.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:15 (12 by maintainers)
Top Results From Across the Web
How to Use NPM Packages in Blazor
Step 1 – Create the Blazor Application · Step 2 – Initialize NPM in your Blazor App · Step 3 – Install NPM...
Read more >Using npm packages with Blazor - by Kedren Villena
We'll start with adding our library to the JS files used by our Blazor application. In _Host.cshtml , add the following line:.
Read more >How do I use NPM packages in Blazor WebAssembly?
To use .npm packages in a Blazor WebAssembly application, follow these steps: ... Right-click on the application and create a new folder named...
Read more >4 Easy Steps to Embed a JavaScript Control into a Blazor ...
This blog explains how to embed a JavaScript control into a Blazor application using the npm packages with 4 simple steps.
Read more >Blazor Javascript isolation with NPM dependencies
I'm trying to use the new Blazor Javascript isolation feature. I'm importing my own JS file as per the example ExampleJsInterop.cs . It...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

If it becomes possible to get the JS code from a different source, we should add some kind of exact version match checking at runtime, blocking the app from starting unless it’s exactly correct. Until now we’ve never had to deal with people using the wrong version of
blazor.webassembly.jsfor their .NET runtime, and it would be good to avoid that becoming a possibility.Note as part of this task, we may want to consider adding official docs on how to use TypeScript with Blazor, environment/project configuration, etc.
cc/ @guardrex. No action now but just so it’s on your radar 😄