Skip to content

Commit

Permalink
fix excessive gleam.mjs generation
Browse files Browse the repository at this point in the history
This patch fixes excessive generation by checking if `modules` is empty.

Two other possible solutions have been ruled out:

- Checking for file existence may result in not updating outdated files
- Comparing contents is slow
  • Loading branch information
--unset committed Jun 2, 2024
1 parent dce475a commit d517764
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiler-core/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ impl<'a> JavaScript<'a> {
}
self.js_module(writer, module, &js_name)?
}
self.write_prelude(writer)?;

if !modules.is_empty() {
self.write_prelude(writer)?;
}

Ok(())
}

Expand Down

0 comments on commit d517764

Please sign in to comment.