Thanks for the report!

We have encountered basically the same underlying issue with WS4's dead code elimination for bundles which made it even more important to get the code dependency graph correct. WS3 is currently not tracking dependencies between types based on field types used. Thiw was fixed for WS4 in https://github.com/intellifactory/websharper/issues/562

A workaround for WS3 would be to explicitly use the Library1.FieldType in Client.page. This can be inside a local function that is unused (and should be eliminated by the optimizer), but the code dependency analyzer looks at the full original code of a method to recursively find all types accessed.

(Current latest Zafir packages are a result of a premature publish, use beta5, we will publish fixed beta6 packages soon.)

By on 2/24/2017 8:02 PM ()

Hi András, thanks for the reply. I tried Library1.FieldType but the outcome remains the same.

1
Cannot read property 'FieldType' of undefined
1
2
3
4
5
6
  let meta = 
    {
        Field = Library1.FieldType.TypeA
    }

  Application.SinglePage (fun ctx -> Content.Page(MainPage.Doc("Test", [ client <@ Client.page meta @> ])))

https://github.com/Kimserey/websharper-meta-error/blob/master/MetaCrash/Main.fs#L27

By on 2/25/2017 12:35 AM ()

Hi, this is a workaround I meant:

1
2
3
4
5
6
    let page (meta: Meta) =
        // workaround: use type Library1.FieldType
        // optimizer removes this but the code dependency 
        // graph is created separately
        let willBeErased () = Library1.TypeA 
        text "Hello world"

I have reopened this issue for WS3, will be included in next bugfix release:

https://github.com/intellifactory/websharper/issues/562

By on 2/25/2017 11:11 AM ()

Hi András, thanks this is working.

By on 2/27/2017 12:59 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us
Built with WebSharper