Avoid duplicate Platform initializer in generated JavaScript#98
Closed
derrickbeining wants to merge 1 commit into
Closed
Conversation
Rename Lamdera's replacement Platform initializer and call sites so generated output no longer emits a second global _Platform_initialize that can shadow downstream tooling patches.
Author
|
Closing this initial compiler-side rewrite in favor of the package-replacement workflow documented in extra/readme.md. The replacement-package PRs are now open at lamdera/elm-core#1 and lamdera/elm-browser#1. |
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.
Summary
_Platform_initialize_Lamderabefore kernel chunks are emitted.Fixes #97.
Why
lamdera make --no-wirecurrently emits a second global_Platform_initializefrom the Lamdera replacementelm/corekernel. Downstream tooling such aselm-watchpatches the standard compiler_Platform_initialize, but the later Lamdera declaration can override that patched function at runtime.Using a Lamdera-specific initializer name preserves Lamdera's replacement runtime behavior without shadowing the compiler runtime name that downstream tools may patch.
Test plan
_Platform_initializedefinitions and that elm-watch rewrites only the first._Platform_initializeshape from transformed output.stack build --fastlocally. The build did not reach this change; it failed in third-party C/native dependencies on macOS (hashable,hfsevents,entropy) against the local SDK/toolchain.Made with Cursor