vite-plugin-eslint icon indicating copy to clipboard operation
vite-plugin-eslint copied to clipboard

Cache is broken.

Open dannysmc95 opened this issue 3 years ago • 10 comments

By default, when using this plugin, it caches the files, but then does not update them, I have noticed this many times.

If you create a file, and get an error, sometimes it does not update the cache (even after saving), and therefore even after restarting the vite dev server, and even making complete code changes (like deleting all the content in a file), it will still throw errors for things that don't exist.

Disabling cache fixes the issue, but that should be the default option until the cache option works correctly.

dannysmc95 avatar Jul 28 '21 11:07 dannysmc95

exactly the same, I've had to disable it but now we're painfully slow

cmcnicholas avatar Jul 29 '21 11:07 cmcnicholas

@cmcnicholas I haven't got a large project yet, but how slow are we talking?

dannysmc95 avatar Jul 30 '21 09:07 dannysmc95

@cmcnicholas I haven't got a large project yet, but how slow are we talking?

20-30 seconds ~40-50 files when opening a new part of the application with some deps already loaded. This obviously will differ for others

cmcnicholas avatar Jul 30 '21 09:07 cmcnicholas

Is there any on going work to resolve this issue? Had to disable caching as causing any lint error and then fixing it meant that using vite build --watch didn't successfully build the project once the linting issue was fixed, it froze instead.

qwerty2k avatar Oct 08 '21 13:10 qwerty2k

This problem only happens when you first time execute vite with eslint errors.

The workaround

  1. Disable cache
  2. Fix your eslint errors
  3. Enable cache
  4. Reset vite command

When the first execute vite command without eslint errors, the cache will work fine.

javialcantaras avatar Nov 02 '21 13:11 javialcantaras

Is there any on going work to resolve this issue? Had to disable caching as causing any lint error and then fixing it meant that using vite build --watch didn't successfully build the project once the linting issue was fixed, it froze instead.

Genuinely not sure if this project is active anymore.

dannysmc95 avatar Nov 02 '21 17:11 dannysmc95

This problem only happens when you first time execute vite with eslint errors.

Good observation! But this is per module, right? So if the first time a particular modules is requested an ESLint error happens, then that particular module is never reloaded, so the error sticks. So the eslint plugin somehow prevents the file/module from being registered for watching/HMR?

AndreKR avatar Aug 08 '22 18:08 AndreKR

This problem only happens when you first time execute vite with eslint errors.

Good observation! But this is per module, right? So if the first time a particular modules is requested an ESLint error happens, then that particular module is never reloaded, so the error sticks. So the eslint plugin somehow prevents the file/module from being registered for watching/HMR?

To confirm the module is reloaded, as you can develop and HMR will update the module, I just think that rather the eslint plugin itself caches the module, and fails to update it's own cache.

@gxmari007 can you give me (or someone) contributor access so we can at least fix the issue...?

dannysmc95 avatar Aug 11 '22 16:08 dannysmc95

@dannysmc95 If you have a fix, even without access you could create a pull request and even publish your version.

Note the there is already a somewhat popular fork.

I haven't tried that fork because I found it after I found vite-plugin-checker, which already solved the issue for me.

AndreKR avatar Aug 11 '22 17:08 AndreKR

This problem only happens when you first time execute vite with eslint errors.

Good observation! But this is per module, right? So if the first time a particular modules is requested an ESLint error happens, then that particular module is never reloaded, so the error sticks. So the eslint plugin somehow prevents the file/module from being registered for watching/HMR?

To confirm the module is reloaded, as you can develop and HMR will update the module, I just think that rather the eslint plugin itself caches the module, and fails to update it's own cache.

@gxmari007 can you give me (or someone) contributor access so we can at least fix the issue...?

PR welcome

gxmari007 avatar Aug 13 '22 14:08 gxmari007