Gulp 4 at the time of this writing is not updating the modification time of the files it alters. I think the last comment I saw was that they now want the plugin authors to alter the modification time.
This really screws up PHPStorm. Using gulp-bump to update the package.json version, would update fine but PHPStorm would still show the file with the un-updated version. If I opened package.json with an external editor. It would show the updated version. If I synced PHPStorm, it would still not update. If I invalidated the caches and Restarted, it would still not show the updated version. I was on the verge of changing IDE’s
This also appeared when running gulp-template where I had some PHP files with the string of
<%= pkg.version %> so that the outputted php file would have the version filled in. PHPStorm would still show the old version, but when I viewed using external editor, it had the correct version.
Finally after trying the following, I realized the modification date of the file was not being altered and this really affected PHPStorm’s ability to cache.
First I ran
ls --time-style='+%d-%m-%Y %H:%M:%S' -l package.json to get the modification time. I would run the gulp process to change the version. Ran the
ls command again and the modification time would be exactly the same. PHPStorm would not see the version change (even with a sync, restart, invalidate cache!) but an external editor would show the version bump. Once I ran a
touch package.json, PHPStorm would show the change.
Found this article:
Will add the through2 package.
Communicated with JetBrain’s support. They were able to reproduce and they pushed it to the issue tracker: (https://youtrack.jetbrains.com/issue/IDEA-220118). Turns out it’s a duplicate and their dev reported that they were not going to fix it.
It is a rare occurrence. This would happen only if the size and modification date is not changed. Since this is a version change only and typically it is just replacing a character, the size isn’t changing either.
Other code editors handled this just fine. Only PHPStorm was having problem.
I asked why syncing the file, invalidating caches, nor restarting would allow PHPStorm to see the new content of the file. They said the caches and VFS ( I’m assuming that’s virtual file system ) are kept separately.