Skip to content

Report the errors Fable raises, and fail the build on them - #67

Merged
nojaf merged 2 commits into
mainfrom
fable-logs
Sep 3, 2026
Merged

Report the errors Fable raises, and fail the build on them#67
nojaf merged 2 commits into
mainfrom
fable-logs

Conversation

@nojaf

@nojaf nojaf commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

A file that type-checks but that Fable cannot translate compiled to a module that does nothing, with no diagnostic anywhere: vite build printed nothing, exited 0, and the app broke in the browser. The cause was upstream, where CodeServices filled a compile's diagnostics from the F# type-check only and threw away the CompilerImpl holding Fable's own logs.

Fable 5.15.0 fixes that (fable-compiler/Fable#4923): a compile now answers with Logs, the type-check tagged FSHARP and everything Fable raised while translating tagged FABLE. Pick the version up and report the FABLE half, for the first compile of the project as well as for every recompile after an edit, so it reaches the terminal, the browser overlay and /api/diagnostics. The FSHARP half keeps coming from FSharpDiagnostic directly, which still carries the error number as a field of its own rather than folded into the message.

fable/initial-compile therefore carries diagnostics, which is what FilesCompiledResult.Success had no room for and why failBuildOnErrors never saw them, and a Diagnostic carries the tag that reported it. Fable's logs have no error number, so the plugin names them by that tag: ERROR FABLE where an F# diagnostic reads ERROR FS0025. Diagnostics under fable_modules are still dropped unless fableModulesDiagnostics asks for them.

The HMR overlay no longer throws when it cannot read the source it is about to frame. A log entry may name no file at all, and losing the error over a missing code frame is worse than showing it without one.

Also updates @fable-org/fable-library-js to 2.6.0, and deletes the roadmap item this closes.

A file that type-checks but that Fable cannot translate compiled to a
module that does nothing, with no diagnostic anywhere: vite build printed
nothing, exited 0, and the app broke in the browser. The cause was
upstream, where CodeServices filled a compile's diagnostics from the F#
type-check only and threw away the CompilerImpl holding Fable's own logs.

Fable 5.15.0 fixes that (fable-compiler/Fable#4923): a compile now answers
with Logs, the type-check tagged FSHARP and everything Fable raised while
translating tagged FABLE. Pick the version up and report the FABLE half,
for the first compile of the project as well as for every recompile after
an edit, so it reaches the terminal, the browser overlay and
/api/diagnostics. The FSHARP half keeps coming from FSharpDiagnostic
directly, which still carries the error number as a field of its own
rather than folded into the message.

fable/initial-compile therefore carries diagnostics, which is what
FilesCompiledResult.Success had no room for and why failBuildOnErrors
never saw them, and a Diagnostic carries the tag that reported it. Fable's
logs have no error number, so the plugin names them by that tag: ERROR
FABLE where an F# diagnostic reads ERROR FS0025. Diagnostics under
fable_modules are still dropped unless fableModulesDiagnostics asks for
them.

The HMR overlay no longer throws when it cannot read the source it is
about to frame. A log entry may name no file at all, and losing the error
over a missing code frame is worse than showing it without one.

Also updates @fable-org/fable-library-js to 2.6.0, and deletes the roadmap
item this closes.
@nojaf
nojaf merged commit 7cb64b5 into main Sep 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant