问题
I see a lot of documentation on F# JS interop and how to use JS code from F#, but I am trying to do the opposite: Call some of my F# code from (inlined) JS. I cannot find any information regarding this. Is it possible? If so how?
回答1:
So after 2 weeks of trying everything I could think about, google every word combination I could think of and creating a SO account to ask for help: I finally found how to do this.
It turns out I needed to add this to my webpack config's output section:
libraryTarget: 'var',
library: 'EntryPoint'
as explained here: https://itnext.io/calling-a-es6-webpacked-class-from-outside-js-scope-f36dc77ea130
As it turns out this is not related to F#, fable or babel but to webpack.
来源:https://stackoverflow.com/questions/53704648/fable-invoke-f-from-js