Skip to content
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

Make "UseJavaScriptSymbol": true the default for Proxy projects #1298

Closed
Jand42 opened this issue Dec 13, 2022 · 0 comments
Closed

Make "UseJavaScriptSymbol": true the default for Proxy projects #1298

Jand42 opened this issue Dec 13, 2022 · 0 comments

Comments

@Jand42
Copy link
Member

Jand42 commented Dec 13, 2022

This adds the JAVASCRIPT conditional compilation symbol so that #if JAVASCRIPT blocks are used.

WebSharper is translating Proxy projects only in a single pass, to generate JS code only, no .NET code generated. So there is no compilation time degradation from this.

On regular F# WebSharper projects, .NET and JS translation are done usually with a single F# parser+typecheck pass to save on compiler running time, for this reason "UseJavaScriptSymbol" setting should be enabled explicitly when you want to differentiate server/client code with a compilation symbol. (An alternative is using the WebSharper.JavaScript.Pervasives.IsClient constant - or just IsClient if you have open WebSharper.JavaScript in F#)

ALSO: this can introduce F# errors that are not present without the JAVASCRIPT symbol, make sure those are printed.

WebSharper's C# compiler currently runs a separate code parser, but maybe best to keep the explicit setting there too, bc this might change with new Roslyn features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant