Uno: Electron Support

Created on 22 Feb 2019  路  5Comments  路  Source: unoplatform/uno

I'm submitting a...

  • Feature request

Current behavior

Embedding an Uno WebAssembly is not functional.

Expected behavior

The WebAssembly head should work properly when hosted in Electron.

Environment

Nuget Package: 

Package Version(s): 

Affected platform(s):
- [ ] iOS
- [ ] Android
- [x] WebAssembly
- [ ] Windows
- [ ] Build tasks

Visual Studio
- [ ] 2017 (version: )
- [ ] 2017 Preview (version: )
- [ ] for Mac (version: )

Relevant plugins
- [ ] Resharper (version: )
areelectron epic kinenhancement platforwasm projecthird-party

Most helpful comment

We've made recent changes that enable better support for Electron. We'll be documenting this soon.

@carldebilly

All 5 comments

From gitter:

I tried to take a brand new Uno App created with the VS template and load it up in the electron quick start repo.

Right away, there are conflicts between the native electron support for "require" and the bundled requirejs library. Basically, the requirejs library is completely ignored in favor of the native require support. This causes a problem since the Uno Bootstraper wraps the call in arrays and electron expects plain strings.

I tried to update to the latest dev version of the Uno.Wasm package, and in this case, chromium refuses to load the wasm files since they are not served with the right content type. I tried to intercept the file protocol which electron uses to load the files but it doesn't let you change de mimeType that's exposed to the browser.

Most of it seems to come from the fact that electron uses the file:// protocol to load resources. The real fix would probably be in electron so that they support the "application/wasm" content type properly. Something you could do is update the bootstrapper to detect electron and use your own custom protocol, something like "wasm://", which would let you inject the right content type.

Also proposed was change how the bootstrapper bundles its files to load them from a byte array.

The goal is to run a UWP app on Windows 7 through electron.

please, do not forget that we can be developing with VSCode in a Linux.

For me, one of the biggest use cases is being able to develop an application that looks like desktop and be able to run in Windows / Mac / Linux and provide the client the power to choose his operating system.

Be able to have the Wasm app running under Electron it's perfect for that.

We've made recent changes that enable better support for Electron. We'll be documenting this soon.

@carldebilly

Why do you want to run a cross-platform app in WASM in Electron? Haven't heard of any use case for it.

The goal is to run a UWP app on Windows 7 through electron.

Wouldn't it be possible with Skia/WPF? Just curious.

@kotx At the time of writing of this issue, Skia/WPF was not available, now it's a bit less useful.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MartinZikmund picture MartinZikmund  路  3Comments

MartinZikmund picture MartinZikmund  路  3Comments

TonyHenrique picture TonyHenrique  路  3Comments

Ali-YousefiTelori picture Ali-YousefiTelori  路  4Comments

JanabiSoft picture JanabiSoft  路  4Comments