Skip to content

fix(esm): hot-reloading - #114

Merged
supermario merged 3 commits into
lamdera:lamdera-nextfrom
lishaduck:esm-output-fixes
Oct 26, 2026
Merged

supermario merged 3 commits into
lamdera:lamdera-nextfrom
lishaduck:esm-output-fixes

Conversation

@lishaduck

@lishaduck lishaduck commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

I figured that seeing as Lamdera 1.5.0 was eminent, I might as well toss some tokens at the human-written #78 to make sure I didn't miss some edge cases before it's released.

As it turns out, although I did check that it ran with the hot-reloading code, I didn't check that hot-reloading actually works. We now add back the scopes that were removed in the esm code paths but are now relevant to hot-reloading; as a bonus, the code is simpler and IMO easier to grok.
I also forgot about html output, which is now incompatible with --esm (it was non-trivial to add, and I don't think there's actually any use to doing so; if it's in the html you can't import it anyway).

While we're there, adds some more tests too.

I've read every line of the diff, I understand it, and I stand by it.1 The thread is public if that provides more (or less—it's good to know if I'm just slopping everywhere) confidence.

Footnotes

  1. With the exception of the cabal change which seemed correct but I'll admit I'm not familiar enough with it to know if there's a better way, hence it's its own commit for easy reversion if needed. ↩

ampagent and others added 3 commits October 25, 2026 17:46
Declare the package-local lamdera executable as a test build tool so CLI tests use the compiler being built rather than an installed release.

Amp-Thread-ID: https://ampcode.com/threads/T-01a16fb0-c28b-735f-9d66-ed30ae50404e
Co-authored-by: Eli <elisha.dukes@gmail.com>
Use the platform exporter to register development hot-reload and cleanup hooks while retaining the named Elm export. Cover state-preserving reloads in development and debug modes and the optimized export contract through the current CLI.

Co-authored-by: Eli <elisha.dukes@gmail.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a16fb0-c28b-735f-9d66-ed30ae50404e
Reject explicit HTML targets and the single-main default with guidance to select JavaScript output. Cover all build modes and preserve classic HTML, ESM JavaScript, multiple-main defaults, and no-output compilation.

Co-authored-by: Eli <elisha.dukes@gmail.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a16fb0-c28b-735f-9d66-ed30ae50404e
@supermario

Copy link
Copy Markdown
Member

Thanks @lishaduck

@supermario
supermario merged commit 6def2fe into lamdera:lamdera-next Oct 26, 2026
1 check failed
@lishaduck
lishaduck deleted the esm-output-fixes branch October 26, 2026 00:57
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.

3 participants