-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report incompatible Fable version from Feliz.CompilerPlugins #539
Comments
Something like this? #if FABLE_COMPILER_3
failwith "Detected Fable v3 compiler using Feliz v2.0.0. Please upgrade Fable to latest v4"
#endif |
I would prefer a compilation error than a runtime error but that's already a plus. And it also assume that the user don't install In the plugin, there is actually a Fable minimum version set but not sure if it does something or not: Feliz/Feliz.CompilerPlugins/Hook.fs Lines 6 to 9 in b8feba4
|
@MangelMaxime I think the |
There is a check against member com.ApplyPlugin<'Plugin, 'Input when 'Plugin :> PluginAttribute>(plugins: Map<_,_>, atts: Fable.Attribute seq, input: 'Input, transform) =
if Map.isEmpty plugins then input
else
// Reverse attributes so plugins closer to member/type are applied first
(input, Seq.rev atts) ||> Seq.fold (fun input att ->
match Map.tryFind att.Entity plugins with
| None -> input
| Some plugin ->
let pluginInstance = System.Activator.CreateInstance(plugin, List.toArray att.ConstructorArgs) :?> 'Plugin
if not(expectedVersionMatchesActual pluginInstance.FableMinimumVersion Literals.VERSION) then
failwithf "Plugin %s expects v%s but currently running Fable v%s"
plugin.FullName pluginInstance.FableMinimumVersion Literals.VERSION
let helper = com.ToPluginHelper()
transform pluginInstance helper input) I will try to look if the check is actually doing something or if there is an bug in it. |
If user use Feliz.CompilerPlugins v2, with Fable 3 there is no compilation error.
Only a runtime one from React about invalid hook usage.
Is it possible detect Fable version and make the compilations fails if it is invalid?
@alfonsogarciacaro
The text was updated successfully, but these errors were encountered: