fable-compiler / repl

Fable online REPL
http://fable.io/repl
MIT License
64 stars 37 forks source link

REPL is broken #119

Closed MangelMaxime closed 3 years ago

MangelMaxime commented 3 years ago

@alfonsogarciacaro First congrats on the release of Fable 3.

I think the new release of the REPL broke it.

I encounter 2 problems:

  1. There is a cache issue where the REPL is trying to load an non existing bundle file.

image

Full url: https://fable.io/repl/app.2e87a0d750e00dfae456.js

  1. If I force to load without the cache then there an error reported by Thoth.Json when receiving information from/on the worker.
[FABLE WORKER] Cannot decode: Error at: `$`
The following `failure` occurred with the decoder: Expected 5 union fields but got 4 worker.min.js:14:163010
alfonsogarciacaro commented 3 years ago

Thanks @MangelMaxime! Oh my, this is weird. I did try after the update and it worked when clearing the cache but I realize now I have to do it every time I open the repl in a new tab. Maybe the service worker is not working properly and we should disable it?

screencast

alfonsogarciacaro commented 3 years ago

I tried to make the ServiceWorker work (pun unintended) but it was giving the same problem so I disabled it for now. Can you please try again?

MangelMaxime commented 3 years ago

Hum at first, it wasn't working for me but after openin it in a Private navigation it works. 🤷‍♂️

However, it you compile an "empty" file you get this error in the console:

Uncaught SyntaxError: class statement requires a name

Nothing too problematic but well, we don't like errors don't we 😂.

I also, see that Thoth.Json or more general the libraries have been removed. Any plan on re-adding them or it was just too hacky?

alfonsogarciacaro commented 3 years ago

Ah, this is funny, it seems it outputs and empty class for an empty file.

image

About the libraries, yes it was hacks all over the place to make them work. I had an idea to serialize inline expressions so any library could be precompiled and loaded onto the repl. I did the first thing, remove the hacks, but unfortunately didn't have have time to implement the second, that is, the new feature. Now I'm in doubt if I should bring back the hacks or try to make the serialized inline expressions work 🤔

MangelMaxime commented 3 years ago

Personnaly, I think that if we can have "clean" solution it is better because in the end upgrading the libraries was not an easy job. I kind of gave up doing it in the end because of the difficulty.

It would be interesting to see if we can load libraries from the REPL wihtout bundling them in it. Kind of like some REPL does it for ELM or NPM. They take them from their package manager directly (npm.org or elm package manager). The idea being that, we don't have to release a new version of the REPL for each library and don't increase the chance of breaking the REPL because of that.

But perhaps it is too complex to make such a system...

MangelMaxime commented 3 years ago

Ah yes, I didn't look at the generated JavaScript ^^

alfonsogarciacaro commented 3 years ago

If what I have in mind can be implemented, it should be possible, but we would still need to put the library sources somewhere because there's no way to download Nuget packages from the browser (that I'm aware of)

MangelMaxime commented 3 years ago

@alfonsogarciacaro Well, if it's just about sending the code somewhere I think it is still better than the previous REPL which had a strong link between the library and the REPL.

alfonsogarciacaro commented 3 years ago

I'll close this as the repl should be working now, please reopen if you still have issues.

MangelMaxime commented 3 years ago

Well, there is still the cache problem on first load. But forcing to clean the cache seems to works.

Perhaps, we could show a message on the loading page saying if loading take more that X... please reload clearing your cache... Not great UX neither...

alfonsogarciacaro commented 3 years ago

Seems the ServiceWorker was still lingering around 😡 I've made another attempt to remove it, can you please try again? (unfortunately you still may need to hard refresh once)

MangelMaxime commented 3 years ago

On this computer it seems ok for me :) Thank you :)