samples-electron icon indicating copy to clipboard operation
samples-electron copied to clipboard

Errors in Fable.Import.Electron in Material UI Sample

Open mike-morr opened this issue 7 years ago • 12 comments

@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 avatar May 13 '17 20:05 mike-morr

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 avatar May 13 '17 22:05 mike-morr

@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

mike-morr avatar May 13 '17 22:05 mike-morr

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.

aolney avatar May 14 '17 19:05 aolney

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?

alfonsogarciacaro avatar May 14 '17 20:05 alfonsogarciacaro

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.

jgrund avatar May 15 '17 05:05 jgrund

@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. 😃

mike-morr avatar May 15 '17 06:05 mike-morr

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:

alfonsogarciacaro avatar May 17 '17 14:05 alfonsogarciacaro

@alfonsogarciacaro No worries, and thank you!

mike-morr avatar May 18 '17 05:05 mike-morr

Hi, any news about fixing this issue?

p69 avatar Jun 15 '17 20:06 p69

@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 :)

alfonsogarciacaro avatar Jun 16 '17 23:06 alfonsogarciacaro

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

p69 avatar Jun 19 '17 09:06 p69

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 :)

alfonsogarciacaro avatar Aug 24 '17 11:08 alfonsogarciacaro