fable-compiler / fable-react-native

Fable bindings and helpers for React Native projects
Apache License 2.0
49 stars 11 forks source link

Xcode chokes on .fable directory #64

Closed playfulThinking closed 3 years ago

playfulThinking commented 3 years ago

Sometimes when I have Expo compile a project, and almost always when I do it in Xcode, I get import errors for every Fable library file like this:

Unable to resolve module ./.fable/fable-library.3.1.1/Types.js from /Users/michaelfremont/Documents/playthink/code/liarliar-admin/src/App.fs.js

The only way I've found to fix this is by renaming the ".fable" directory to "fable" and changing the paths in the generated fs.js files; it then complies, but this is not a workable solution.

Any ideas? Thanks much.

alfonsogarciacaro commented 3 years ago

Hmm, so I'm guessing XCode treats directories starting with . as really hidden. I guess we can fix this two ways:

  1. Enable a CLI option to rename .fable folder.
  2. Renaming the .fable hidden folder to fable_modules or similar. It's ignored because it contains a .gitignore file not because of the name, and I assume it won't be a breaking change because it's dealt with automatically anyways.

Thoughts? cc @MangelMaxime

MangelMaxime commented 3 years ago

I am in favour of "better" defaults so if renaming it to fable_modules is transparent we can go this way.

playfulThinking commented 3 years ago

That would be awesome!

On Thu, Sep 30, 2021 at 1:41 AM Maxime Mangel @.***> wrote:

I am in favour of "better" defaults so if renaming it to fable_modules is transparent we can go this way.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fable-compiler/fable-react-native/issues/64#issuecomment-931046677, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL4YZWQIQLGA3WOJTPNN3DUEQPDDANCNFSM5FBG2IUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

inosik commented 3 years ago

Should we consider moving the directory to obj/?

Anyways, Paket needs to be patched then. It ignores the .fable/ directory when looking for projects. /cc @forki

alfonsogarciacaro commented 3 years ago

With Fable 3 when using --outDir the .fable hidden folder is located in the outDir and it's normally outside of the .fsproj and obj hierarchies.

Ah, true about Paket :/ I think Ionide does something similar. Maybe we could change the .fsproj extension to .fableproj as a trick to avoid this kind of issues...

inosik commented 3 years ago

With Fable 3 when using --outDir the .fable hidden folder is located in the outDir and it's normally outside of the .fsproj and obj hierarchies.

Ah right. obj/ only makes sense if the output directory is the same as the source directory. I just thought obj/ would be ignored by most tools in the .NET world and wouldn't show up anywhere.

You're right, Ionide ignores the .fable/ directory as well: https://github.com/ionide/ionide-vscode-fsharp/blob/652c12430cd759162997ca4a7633da680d200354/release/package.json#L1302

alfonsogarciacaro commented 3 years ago

@fremontmj Can you please try with Fable 3.4 and confirm if the issue is solved? Thanks!

playfulThinking commented 3 years ago

@alfonsogarciacaro That seems to have done it. So amazed and thankful to the fast reaction to my issue. You guys rock.