This might be related to browserSync. Have you removed that to check?
Aug 29, 2017
9
Level 3
Laravel Mix 'npm run watch' recompiles everything every time I change a file
I'm kinda new to Mix. It's been great so far but I don't know why whenever I change one of my source files, It recompiles almost all my assets instead of just recompiling the appropriate modified file.
For example, If I change something in app.js and save it, it somehow detect changes in all of my css files. So I would see something like this in the console
WAIT Compiling...
95% emitting
DONE Compiled successfully in 239ms
Asset Size Chunks Chunk Names
/fonts/fontawesome-webfont.eot 166 kB [emitted]
/css/app.css 13.6 kB 0 [emitted] /js/app
/css/fonts.css 123 kB [emitted]
/css/custom.css 52.8 kB [emitted]
/css/font-awesome.min.css 31 kB [emitted]
+ 4 hidden assets
[Browsersync] File event [change] : public/css/app.css
[Browsersync] File event [change] : public/css/fonts.css
[Browsersync] File event [change] : public/css/custom.css
[Browsersync] File event [change] : public/css/font-awesome.min.css
This also happens when I change a css file. It prints a similar output and right after injecting the css code, it refreshes the browser. So it's really annoying and uncomfortable.
This is my webpack.mix.js :
let mix = require('laravel-mix');
mix.disableNotifications()
.styles([
'./resources/assets/fonts.css'
],'./public/css/fonts.css','./public/css')
.styles([
'./node_modules/animate.css/animate.min.css'
],'./public/css/custom.css','./public/css')
.stylus('resources/assets/stylus/app.styl', 'public/css', {
use: [
require('rupture')()
]
}).options({
postCss: [
require('lost')()
]
})
.copy('./node_modules/font-awesome/css/font-awesome.min.css', './public/css/font-awesome.min.css')
.copy('./node_modules/font-awesome/fonts/*', './public/fonts/')
.js('resources/assets/js/app.js', 'public/js')
.js('resources/assets/js/test.js', 'public/js')
.extract(['vue','lodash', 'jquery']);
if (mix.inProduction()) {
mix.version();
}else{
mix.browserSync({
proxy: 'test.dev',
ghostMode: false
});
}
Any help would be appreciated. Also please let me know if I can improve my webpack.mix.js file.
Please or to participate in this conversation.