Report the errors Fable raises, and fail the build on them - #67
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.