Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File watching doesn't work on Windows machines running the system in a container #7826

Closed
colinnewell opened this issue Sep 26, 2020 · 7 comments

Comments

@colinnewell
Copy link

If I run quasar dev in a container on windows changes in files are not detected.

The usual way to work around that is to configure whatever is watching the files to switch to polling.

It looks like Quasar is using chokidar which does appear to have a polling option, but it doesn't appear that I can push options to it from the quasar.conf.js. Ideally I'd like to be able to provide it with configuration via that file.

@colinnewell
Copy link
Author

Looking at this some more, I suspect it's just the watching of a couple of specific files that are problematic. quasar.conf.js and index.template.html are the files that probably won't work.

It looks like the bulk of the source is watched by webpack, and that config is accessible. A tweak like this appears to work fine for most files:

diff --git quasar.conf.js quasar.conf.js
index de7eda2..47c014f 100644
--- quasar.conf.js
+++ quasar.conf.js
@@ -76,7 +76,10 @@ module.exports = function (/* ctx */) {
     devServer: {
       https: false,
       port: 8080,
-      open: true // opens browser window automatically
+      open: true, // opens browser window automatically
+      watchOptions: {
+        poll: 1000
+      }
     },
 
     // https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework

@Karnith
Copy link

Karnith commented Sep 27, 2020

I have this issue as well. Changing any file will not recompile the project, leaving me to halt and run dev again..
** Edit **
The fix above works.

@hawkeye64
Copy link
Member

@colinnewell @Karnith I have added this to docs. Will be in next update/release.
image

@colinnewell
Copy link
Author

It's just been pointed out to me that there is an alternative way to switch to polling that will probably work for all the watchers (rather than just webpack).

You can set an environment variable to tell the chokidar library to poll which should affect both your code and the webpack which uses it too.

CHOKIDAR_USEPOLLING=true

@Karnith
Copy link

Karnith commented Oct 7, 2020

It's just been pointed out to me that there is an alternative way to switch to polling that will probably work for all the watchers (rather than just webpack).

You can set an environment variable to tell the chokidar library to poll which should affect both your code and the webpack which uses it too.

CHOKIDAR_USEPOLLING=true

@colinnewell so would this be in a .env file or directly in quasar.conf.js? I ask as I don't seem to find any references on .env files in the documentation website.

@colinnewell
Copy link
Author

@colinnewell so would this be in a .env file or directly in quasar.conf.js? I ask as I don't seem to find any references on .env files in the documentation website.

@Karnith you could set the environment variables in multiple ways. If you're using something like docker-compose you can set them in the config there, or if running as a single container using docker run you can specify using -e CHOKIDAR_USEPOLLING=true.

It looks like there may be a way to do it from the quasar.conf.js, but I'm not sure if the life-cycle would be quite right.

https://quasar.dev/quasar-cli/handling-process-env#Adding-to-process.env

@Karnith
Copy link

Karnith commented Oct 7, 2020

@colinnewell I tried with quasar env https://quasar.dev/quasar-cli/handling-process-env#Adding-to-process.env, it didn't work. i'll try with docker-compose. The polling setting is working for me in quasar.config, so it's not a high priority. thx.

@IlCallo IlCallo mentioned this issue Nov 25, 2020
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants