Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Fix: Ionic serve files out of date #1521

Merged
merged 1 commit into from
May 24, 2019

Conversation

intodevelopment
Copy link
Contributor

@intodevelopment intodevelopment commented Mar 8, 2019

Short description of what this resolves:

When running ionic serve it often happens that the transpiled files become out of date. After making a change to one of the TypeScript source files, ionic serve runs, but when looking at the built JavaScript files, the new code is not present. I found that the app-scripts build process kept two file caches. One in the app-script context and one in the so called InMemoryCompilerHost. The first was updated when files changed, but the latter wasn't. The InMemoryCompilerHost cache is in my opinion superfluous, because it got injected a HybridFileSystem, which nicely uses the app-scripts context fileCache. My solution is to remove the cache from the InMemoryCompilerHost, rename the InMemoryCompilerHost to FileSystemCompilerHost and let the injected HybridFileSystem handle the caching. This solution not only fixes the out-of-date-files issue, but also reduces memory usage of app-scripts.

Changes proposed in this pull request:

  • Remove superfluous caching mechanism from InMemoryCompilerHost
  • Rename InMemoryCompilerHost to FileSystemCompilerHost

Fixes: #1432, #1139

When running `ionic serve` it often happens that the transpiled files become out of date. After making a change to one of the TypeScript source files, ionic serve runs, but when looking at the built JavaScript files, the new code is not present. I found that the app-scripts build process kept two file caches. One in the app-script context and one in the so called InMemoryCompilerHost. The first was updated when files changed, but the latter wasn't. The InMemoryCompilerHost is in my opinion superfluous, because it got injected a HybridFileSystem, which nicely uses the app-scripts context fileCache. My solution is to rename the InMemoryCompilerHost to FileSystemCompilerHost and let the injected HybridFileSystem handle the caching. This solution not only fixes the out-of-date-files issue, but also redecuses memory usage of app-scripts.
@intodevelopment intodevelopment changed the title Ionic serve files out of date Fix: Ionic serve files out of date Mar 16, 2019
@intodevelopment
Copy link
Contributor Author

@liamdebeasi Could you or someone else from the Ionic team please have a look at this pull request? It would really help our development team to be more productive when they wouldn't have to restart ionic serve every time they make changes. Many thanks!

@liamdebeasi liamdebeasi merged commit 266a871 into ionic-team:master May 24, 2019
@liamdebeasi
Copy link
Contributor

Thank you very much for this PR! I will be shipping 3.2.4 shortly. 🎉

@intodevelopment
Copy link
Contributor Author

Thank you for responding so quickly and accepting the PR!

@intodevelopment intodevelopment deleted the out-of-date-files branch May 25, 2019 06:17
@RaschidJFR
Copy link

Thank you @intodevelopment , one of the greatest fixes in the history of v3!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants