Laravel and Docker: What are best practices for watching for script / sass changes in webpack.mix.js?

307 Views Asked by At

I've got a Laravel 8 application running on a Docker stack (NGINX, PHP, MySQL). I'm trying to figure how to properly watch for script and sass changes (or anything in my mix file webpack.mix.js).

My question is: What's the best (or proper way) to poll for changes when running a laravel app on docker?

I've tried docker-compose exec app npm run watch and docker-compose exec app npm run watch-poll and neither trigger an update when I make changes to any of the files in my webpack.mix.js.

(I should note app is my PHP service)

My package.json file is pretty standard:

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production"
  },
  "devDependencies": {
    "axios": "^0.21",
    "laravel-mix": "^6.0.6",
    "lodash": "^4.17.19",
    "postcss": "^8.1.14"
  }
}

Thanks in advance!

0

There are 0 best solutions below