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

Worker npm_encore_watch watch a file #407

Open
ellmout opened this issue Jan 4, 2024 · 10 comments
Open

Worker npm_encore_watch watch a file #407

ellmout opened this issue Jan 4, 2024 · 10 comments

Comments

@ellmout
Copy link

ellmout commented Jan 4, 2024

Hi,

When working with npx encore dev --watch as a worker, when you change webpack.config.js, you have to restart the worker.

So i config my worker as this :

  npm_encore_watch:
     cmd: ['npx', 'encore', 'dev', '--watch']
     watch: ['webpack.config.js']

To watch for modification of webpack.config.js and restart the worker when i update it.

But it doesn't work !

I have a worker for messenger :

  messenger_consume_async:
     cmd: ['symfony', 'console', 'messenger:consume', 'async']
     watch: ['config', 'src', 'templates', 'vendor']

It works great but only watch dir !

Thx

@sarim
Copy link
Contributor

sarim commented Jan 5, 2024

I guess it's another macos specific issue? It works in my ubuntu.

Off topic: Interesting that webpack itself doesn't reload itself. As webpack is running in watch mode. (I personally use vite, which actually reload on config change).

@tucksaun
Copy link
Contributor

@ellmout work okay for me here.
by any chance: which editor are you using? (some editors updates files content in-place whereas others create new files and then rename them which can cause issues detecting changes)

@ellmout
Copy link
Author

ellmout commented Jan 24, 2024

hi,
i'm on macOs, using phpstorm !

@tucksaun
Copy link
Contributor

well works for me, I don't really see what could cause your issue 🤷

@tucksaun
Copy link
Contributor

oh except maybe something (just seen that before closing the IDE): you might have autosave enabled and so the reload already happened before you actually hit "Save" ?

@tucksaun
Copy link
Contributor

other hypothesis: maybe your file is not on an actual macOS filesystem (samba share, NFS mount, this kind of things) which might not work with FS change notifications?

@ellmout
Copy link
Author

ellmout commented Jan 24, 2024

I'm working in my home folder.
I'm making some test this morning

@ellmout
Copy link
Author

ellmout commented Jan 24, 2024

Juste made some test, i set log level to 4 to see debug info and got :
image

But i think the cli can't restart npm watch because of #402

@ellmout
Copy link
Author

ellmout commented Jan 24, 2024

i confirm it's related to #402
when i run npm run watch, i can't kill it with kill -2 or kill -15, it works with kill -9 but it leaves a webpack process running.
i replace npm run watch with

  npm_encore_watch:
    cmd: [ 'node_modules/@symfony/webpack-encore/bin/encore.js', 'dev', '--watch']
    watch: [ 'webpack.config.js' ]

and it's working great !
i will keep it like this for the moment

zulus added a commit to zulus/symfony-cli that referenced this issue Jan 29, 2024
@yguedidi
Copy link
Contributor

to add one more exemple, I'm using PHPStorm Startup tasks to start the serve command, and now on latest version when I close PHPStorm I get this:
image
and it waits indefinitely, I have to click "Kill process".
before it closes without manual intervention

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

No branches or pull requests

4 participants