Ionic serve cache problem?

Hi,
Sometimes, when i edit my files, save, my app reload and my html file doesn’t reload.
Worst, sometimes, i edit another file (a .ts file for exemple), it reload, and, i dont know how, i get an older html files (already saved since 5-10 min)

So when it happen, i must exist ionic serve (ctrl +c) and run it again, and wait…

Someone got this?

thanks.

2 Likes

Thats the same issue from this thread Weird stuffs with rebuild?

For me it did not happen anymore after updaten my project to the latest version. But i have to do more testing to be sure.

Yup i noticed this problem sometimes. In doubt i keep chrome network tab open with the “clear cache” flag enabled.

However with the android emulator the livereload sometimes is completly useless.

I opened the thread listed above. For me weird stuff/cache not reloaded problem happens most of the time when I edit “sub-component” (component I use in other component). I’m up-to-date with both Ionic 2 and app-scripts

I’m already up to date (2.2.0) app-script 1.1.4 :o, chrome network is already in “disable cache” mode but it seem useless.
When it happen it’s juste so frustrating ^^’

1 Like

In my case, the browser loads an old HTML template and keeps reloading it without reflecting any new changes I add, until I stop ionic serve and re-run it.

Any idea if this is related to Chrome caching or ionic serving an older file ? @mhartington

1 Like

Isn’t your issue the following one: https://github.com/driftyco/ionic-app-scripts/issues/794

Yes that seems like it. Thanks ! Hopefully it gets fixed soon.

I still have this problem. After every change I make it loads an older version of my app. My problem is exactly like the issue @reedrichards posted. On April 6 @danbucholtz posted that it should be fixed in version 1.3.1, but I’m still having problems after updating to (I think) the latest versions. I’m using this versions right now:

“dependencies”: {
"@angular/common": “4.1.2”,
"@angular/compiler": “4.1.2”,
"@angular/compiler-cli": “4.1.2”,
"@angular/core": “4.1.2”,
"@angular/forms": “4.1.2”,
"@angular/http": “4.1.2”,
"@angular/platform-browser": “4.1.2”,
"@angular/platform-browser-dynamic": “4.1.2”,
"@ionic-native/core": “3.9.1”,
"@ionic-native/splash-screen": “3.9.1”,
"@ionic-native/status-bar": “3.9.1”,
"@ionic/storage": “2.0.1”,
“angularfire2”: “^4.0.0-rc0”,
“firebase”: “^3.9.0”,
“ionic-angular”: “^3.3.0”,
“ionicons”: “3.0.0”,
“rxjs”: “5.1.1”,
“sw-toolbox”: “3.4.0”,
“zone.js”: “^0.8.10”
},
“devDependencies”: {
"@ionic/app-scripts": “^1.3.7”,
“typescript”: “~2.2.1”
},

Did I miss something? How can I fix this annoying problem?

[update]
Looks like it has something to do with the service worker. Stopping and unsubscribing from the service worker using chrome://serviceworker-internals/ did the trick for me. Found in it this topic.

2 Likes

A post was split to a new topic: Weird caching issues with service worker

I am still having this issue… same like @usiko

My setup:
$ ionic info

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.1.0
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : none
    Ionic Framework                 : ionic-angular 2.3.0

System:

    Node       : v6.9.5
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b 
    ios-deploy : 1.9.1 
    ios-sim    : 5.0.13 
    npm        : 5.0.3 

You should see if upgrading this fixed things (please read the changelog for breaking changes).

Thanks, I will try upgraded versions… first 1.3.12 as it should be non-breaking, and if it will not help, then I will try 2.0.0. I will let know the results after few days testing.

1 Like

It’s happening in 2.0.0 to me. PITA :rage:

I can confirm, it is still happening with 1.3.7, ionic sometimes serves old version of files :confused: So I need to make visible change every save to be sure that I have actual version of code… it is very sad :sob: I will try 2.0.0 next week, because I am publishing the app today I cannot risk with major change of package :scream:

Have a look to https://github.com/ionic-team/ionic-app-scripts/issues/794

I personally don’t face the issue but look like some people are still facing it and commenting the issue, maybe it will help you out with some tips

1 Like

Thanks. Already went through all of that and nothing.

in my code the picture i set is different
photo: ‘assets/img/profile.jpg’,
the output showing old image that comes with ionic -starter-super template.

only if i goto that .ts file and add a space then save it wll show the new image

I can’t say that this is the actual cause or solution but this is what happens with me.

That issue only occurs with me if I’m working too fast, meaning, saving files before the rebuild is finished. If I work in one component and save, it triggers the rebuild process. If I edit another component and save (before the rebuild of the previous save finishes), the rebuild of the new save trigger almost immediately, while the previous rebuild is in progress, and disregarding changes I made to the previous component.

If I work slower, meaning, save the file and wait for the rebuild to finish before saving another file for rebuilding, it seems to work ok without issues like this.

It looks to me like the rebuilding process does not wait for a previous rebuild to finish thus the cached files keeps on overriding each other with older versions.

I can also confirm this. It’s not the old problem that was discussed here but rather when I save to fast two different files before build is finished. To make things easier it doesn’t seem to go wrong every time :slight_smile:

For info: I don’t have the latest ionic cli so maybe this is already fixed. But don’t see anything in the changelog.

cli packages: (/usr/lib/node_modules)

    @ionic/cli-utils  : 1.13.1
    ionic (Ionic CLI) : 3.13.2

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.8.0

System:

    Android SDK Tools : 25.2.5
    Node              : v6.11.4
    npm               : 3.10.10 
    OS                : Linux 4.4

Misc:

    backend : pro