Skip to content

--define values leak between builds #4878

Description

@OrfeasZ

A define from an earlier build stays active in later builds that don't pass it. This seems to happen because project_cracked.json caches the defines of the build that created it, and is not refreshed on subsequent runs, so the compile gets the union of the cached and the current ones. Deleting that file or building with --noCache fixes the issue.

For example, in a project with a source file like the one below:

let first =
#if FIRST
    true
#else
    false
#endif

let second =
#if SECOND
    true
#else
    false
#endif

printfn "FIRST=%b SECOND=%b" first second

Running fable --define FIRST -o out && node out/Program.js, the output is the expected FIRST=true SECOND=false.

But then, if you run dotnet fable --define SECOND -o out && node out/Program.js, the output is now FIRST=true SECOND=true instead of the expected FIRST=false SECOND=true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions