Skip to content

Laravel npm run watch not compile in runtime scss and js

Hi I have issue with new laravel project. I know it should be autocompile scss and js after command npm run watch. But it not recognized any changes and i don t know why.

My webpack.mix.js looks like this:

const mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css');

For compiling a changes i have to put every time npm run watch. Please if you know why let me know.

Log from console:
 DONE  Compiled successfully in 8794ms                                7:57:59 AM

       Asset      Size   Chunks             Chunk Names
/css/app.css   179 KiB  /js/app  [emitted]  /js/app
  /js/app.js  1.66 MiB  /js/app  [emitted]  /js/app

But this never changed in runtime….

Answer

Oh I run npm run watch on homestead server… When i try it in local enviroment it works fine. This is solution