-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Need something better/faster than NPM installed Electron.. #608
Comments
Help! I'm in danger of starting a new project (since this isn't really an Indigo specific thing, in fact.) What do you get, if you combine:
Why... you have a hot reloading dev server! Then what if you layer on, say, selective asset copying and processing as we have in Indigo? Well now you've got a primitive bundler. And what if, you strap a WebView to it? Well, now you've got a crude electron/tauri replacement. And what if, as well as (or instead of?) running standalone, you put it in a Mill/sbt plugin? Now you've got a full Scala FE dev server built right into your normal dev flow... do you not? And none of that needs NPM. |
Here is the embarrassingly small amount of code needed for a simple static service using cask, that I used to run an indigo game from a subdir called package app
object StaticFiles extends cask.MainRoutes {
override def port: Int = 1234
override def host: String = "localhost"
@cask.get("/")
def index() = {
cask.Redirect("/indigo/index.html")
}
@cask.staticFiles("/indigo", headers = Seq("Cache-Control" -> "no-cache"))
def staticFileRoutes() = "site/."
initialize()
}
|
Some comments from a quick reading: Step 1 (hot reloading dev server) sounds awesome. I would love to see something like that. I think some plugins like scalajs-bundler do that, but they need npm/webpack under the hood, and I would love to see something simpler. Step 2 (primitive bundler) sounds OK to me, although I'm not sure if it's entirely necessary (you could always fetch the assets from the static server), but if it's already done, it's a nice extra. Step 3 (Java WebView) is what I have more concerns. I didn't know about JavaFX |
Hi think it is a very good idea and I was surprised this hasn't been done before by Laminar team or other SJS frontend. It would be very useful not only for Indigo but also Tyrian, Laminar etc...
If I understand correctly, it would be JavaFX-based? This seems to be a good idea since we could eventually use all the JFX tools (like Gluon Native etc...) to package our app. Also for your interest, someone made a working Scala Native/SJS project with Webview (I failed to find the repository again sadly). |
Yes indeed @Iltotore, I think it should be a separate project that is agnostic to what you're building or what tools you're using. I was also thinking how nice it would be for Tyrian to (optionally / by-default) be an NPM-less dev experience...
Yes to all of that @JD557, particularly the WebGL support concerns. However, as long as it has WebGL 2.0 support, even if it's sub-par to a full electron build, it might still be good for use during development, and then you package it up in something more sophisticated (and well supported) for publication. This is really all about a lovely, fast, responsive, hot loading, pure scala / scala-first, dev experience. |
From @zetashift:
|
WebView isn't going to work well. There are two problems:
On the other hand, the dev server part looks very doable. |
Which "WebView" isn't going to work? The project or JavaFX's WebView? |
JavaFX / ScalaFX. |
I have a workaround for this... (needs the next Indigo release i.e. > 0.15.2, due any day now) as long as you're a Nix flakes user. 😛 (Well, it probably works for other set ups too, I'm just getting Nix to do it and haven't tried it any other way...) Nix based global Electron installs are as bad as any other, I think I tried them in a flake too and they were also bad, as mentioned in the original message. However, what can do is add this to your nix flake hook (naturally I have yarn being installed in the flake too...):
This gives you a good, local electron accessible via
...and hey presto, no more waiting for npm to check the install on every launch. Much faster. |
Once upon a time, we just used a globally installed Electron, and all was good, because there was no delay caused by NPM checking that the local install was present and correct.
Except all wasn't well at all, because globally installed Electron instances have shockingly bad / unpredictable performance for reasons I've never really dug into.
So now we do the local install thing, and this slows down our ability to iterate quickly, and sometimes NPM just hangs.
Is there something else we can use? Is it time to revisit WebView or something? Or if we stay with Electron, how about bundling up known good versions in a Jar or something?
The text was updated successfully, but these errors were encountered: