Every time I run npm run watch dashboard.js is succesfully compiled into all.js.
However every time I make a change in dashboard.js the all.js empties never to fill it up again. If I Ctrl+c the process and run npm run watch again it compiles it successfully again.
If I have more than one js to combine only the one I change gets dropped from the code of the finished all.js.
This is bad because every time I make a change in the js (that I'm currently developing) I need to go back and restart the process and wait for it.
@ourbg Please post your entire webpack.mix.config. Also, a tip for when things get buggy with Laravel Mix...I usually remove my node_modules and lock file and run npm install again. ( out of 10 times it corrects strange issues because of a problem with a package dependency.
let 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/assets/js/app.js', 'public/js')
.combine([
'resources/assets/js/specific/articles.js',
'resources/assets/js/specific/countries.js',
], 'public/js/specific/all.js')
.sass('resources/assets/sass/app.sass', 'public/css');
mix.options({
processCssUrls: false
});
Doesn't matter if I use combine or scripts or whatever it always empties the compiled file after I change the one in resources dir.
I am not sure what the exact issue is. It is normal for Webpack to re-compile files while running watch. However, I am not sure if combine will run again when a change is detected. That may be the issue you are facing.
Maybe yes. It's the same with "scripts" or just "js" instead of combine. But I'm just going to put every js resource into a different file and it's working fine.