question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Publish blazor.*.js files to npm

See original GitHub issue

I’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:open
  • Created 4 years ago
  • Reactions:7
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
SteveSandersonMScommented, Jan 10, 2022

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.js for their .NET runtime, and it would be good to avoid that becoming a possibility.

1reaction
TanayParikhcommented, Dec 9, 2021

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 😄

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found