fable-compiler / samples-electron

Fable bindings and samples for Github Electron
Apache License 2.0
60 stars 12 forks source link

Errors in Fable.Import.Electron in Material UI Sample #17

Open mike-morr opened 7 years ago

mike-morr commented 7 years ago

@Pauan and I are getting many errors like the following in the Material UI sample:

error FS0039: The namespace or module 'NodeJS' is not defined. Maybe you want one of the following: N ode [C:\Users\mimorr\Code\fable-electron\fable-electron.fsproj] error FS0887: The type 'obj' is not an interface type

mike-morr commented 7 years ago

Just to clarify this issue is preventing me from updating the other samples, as the issue impacts the only two samples that have been updated to narumi. This means there is no working electron sample.

mike-morr commented 7 years ago

@alfonsogarciacaro I tried rolling back to your original narumi commit which I could have sworn was working last time I tried it. However I had the same problem. It's like the file was rolled back to the old version or something

aolney commented 7 years ago

I created a 6x branch for the old samples leaving master for the 1.0 samples. The material UI sample was reverted on the 6x branch.

alfonsogarciacaro commented 7 years ago

Hmm, unfortunately it seems the latest changes to the Node bindings contained many breaking changes. @jgrund Do you know how to fix this? For things like __dirname apparently we need to add Node.Globals but other modules like fs are completely gone. Should we go back to the old bindings?

jgrund commented 7 years ago

Hi,

It looks like to fix, we'd want to change all the NodeJs.EventEmitter references to just EventEmitter (once PR to add AutoOpen is landed and published). I've also created a PR for the fs module.

Is something like this still needed with latest bindings? https://github.com/fable-compiler/fable-electron/blob/master/npm/Fable.Import.Electron.fs#L24

It seems like it's implementing an EventEmitter with the same interface that already exists.

I'd like to try and keep the new bindings if possible. I know they are not complete yet, but I can work to fill in the holes. I think we can add more functionality than is present in the typescript interfaces.

I'd also be fine if you wanted to revert and try to push again later when I have more covered.

mike-morr commented 7 years ago

@jgrund @alfonsogarciacaro I need to build a line of business app with electron. Unlike most of the code I provide my customers, this time they only care about it from the user perspective, they don't care about what it is written in. Usually, the "sample" code I give them has to be in C#.

This would be for a large government agency, although only a handful of people 5-15 would be using this app. I REALLY want to use this, as my fallback is TypeScript. If we can get something up and working with these types temporarily, I could help identify the holes as I move along, and use workarounds like Emit until we get the types fixed. Node.fs is really the only one I know i am going to use for sure. The app is mostly going to retrieve and store data from a REST API.

I was going to update the samples as a learning exercise to make sure I understand how they are put together.

Any help would be greatly appreciated. It is hard for me to imagine writing a sizable amount of TypeScript code knowing I could be using this instead. 😃

alfonsogarciacaro commented 7 years ago

Sorry @mizzle-mo I've been busy the last couple of days fixing issues after the Paket integration. I'll check the node bindings now together with @jgrund and fix the electron sample :+1:

mike-morr commented 7 years ago

@alfonsogarciacaro No worries, and thank you!

p69 commented 7 years ago

Hi, any news about fixing this issue?

alfonsogarciacaro commented 7 years ago

@p69 We just announced the release of Fable 1.1 stable. The node bindings have also been fixed. Now we just have to update the rest of the libraries (including Electron). This should be finished within the next week :)

p69 commented 7 years ago

@alfonsogarciacaro Thank you very much for your work! Can't wait to try it for electron app.

alfonsogarciacaro commented 7 years ago

It took a while but we finally updated the sample to Fable 1.2 beta, could you give it a try? Please check README for instructions and note the name of the repo has changed to samples-electron.

For now there's just one single example, we'll bring back the other (and new) samples later :)