I love the idea of Blazor. Getting rid of Javascript and using C# for everything, what’s not to love.
Well after trying it for a couple of projects, here’s everything that is wrong right now.
1. Google
Google doesn’t index Blazor sites. It doesn’t load the webassembly. It only parses what’s on the page before the webassembly loads.
You could liken this to sites running VueJs – but you shouldn’t because Google parses Javascript and indexes those fine.
The suggested solution to this is to also generate the page serverside as a placeholder. If you’re doing that you might as well make the whole site serverside imo.
I’m sure if enough sites go webassembly that Google will have to eventually start loading them up and indexing them properly – but it ain’t happening yet.
2. Javascript
Unfortunately you still can’t escape Javascript.
First of all there’s the startup javascript. I’d have thought loading a webassembly would be like including an image, but it’s apparently more complicated than that, requiring just under 100kb of javascript before it loads its first wasm.
Then apparently it can’t do certain things, like set the page title, or search the page and manipulate certain elements, or draw to a canvas, or play a sound, or get the window size. So you end up having to write shitty javascript interop functions to be able to do what you want. So now you’re not only writing javascript, you’re writing shitty javascript. You can’t help but feel that any performance benefits of using web assembly are flushed down the bog because everything goes though a layer of javascript anyway.
3. Source Code
You’d think since you’re compiling to webassembly your code would all be jumbled up assembly that no-one can download and understand? Right?
Nope. It’s legit c# dlls. You can download them and decompile to view the contents like any other .net dll.
4. Download Size
Maybe since they’re all common Dlls they’re versioned and downloaded and cached from a microsoft cdn, so once you’ve visited a blazor site you already have 90{0d2ea9d8d397d6ae549d7a28eabdef52cc52010845161897a8736269cd0593be} of the content cached?
Nope. Hope you like downloading 5mb to view a single page with the words “Hello World”
Summary
I love c#, I love doing web stuff, I don’t love javascript. Blazor is the answer to my prayers in a lot of ways.
This is all new, so I’m sure all this stuff will get better over time, but for me right now it isn’t ready to replace anything that needs indexing that gets casual viewers.
Add a Comment