Fix problems with watch mode with --workers=1 - #683
Merged
Conversation
Previously, we were accidentally writing `Elm` to the global object, and Elm has checks in place for this: > Your page is loading multiple Elm scripts with a module named Elm.Test.Generated.Main. Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which! This commit fixes the wrapper around the Elm JS code so that we write to a temporary, local object instead.
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.
Followup on #680.
There were a couple of problems with single-threaded watch mode (
--workers=1 --watch):requirecache.before.jswas wrong.To measure memory usage, I used the following patch:
It puts a ~30 MB object in the Elm model. This makes it easy to see if the memory usage is growing with each run.
After each run I force garbage collection. (Requires
--expose-gc.) Every second I measure used heap space.Before, the memory usage increased with ~30 MB per run. After, the memory usage is unchanged after each run.
Run it like so:
Then make a change to one of the test files (or
touchit) to trigger new runs.