ctf0 / laravel-mix-versionhash

Auto append hash to file instead of using virtual one
MIT License
61 stars 18 forks source link

Versionhash prevents Browser Sync from starting #29

Closed roelofr closed 4 years ago

roelofr commented 4 years ago

I noticed my browsersync no longer starting when developing. I've isolated the error to be originating from the Mix.listen('done', …) call in index.js:208, but can't really tell why it's happening.

No error or warning is issued, so it would seem browerSync can't launch because this hook is blocking.

Wrapping the whole ordeal in a try-catch does solve the issue.

ctf0 commented 4 years ago

@Erutan409

Erutan409 commented 4 years ago

@roelofr I'd suggest reverting back to 1.0.8 for the time-being.

@ctf0 I haven't had to time to refactor it into a promise-like fashion, yet. Even then, when that's done, I'd recommend tagging it as a beta for people to test and get confirmation back on.

roelofr commented 4 years ago

I solved it on my end by only loading version hash (the require statement) when Mix is in Production.

if (mix.inProduction()) {
  require('laravel-mix-versionhash')
  mix.versionHash()
}
ctf0 commented 4 years ago

@Erutan409 ok, np @roelofr can u update the rdme with this case & solution ?

roelofr commented 4 years ago

@roelofr can u update the rdme with this case & solution ?

Yes, made a small change to the README.md file in #30.

terryupton commented 4 years ago

This also throws a bug in development too. Cannot read property 'length' of undefined

The above fix resolves both issues. https://github.com/ctf0/laravel-mix-versionhash/issues/29#issuecomment-554373375

ctf0 commented 4 years ago

@roelofr @terryupton could u plz try the latest version with ur setup & reply back if u still need the temp solution of https://github.com/ctf0/laravel-mix-versionhash/issues/29#issuecomment-554373375 ?

terryupton commented 4 years ago

@ctf0 I have just tested this on a project and it all looks to be working correctly now. I moved the require('laravel-mix-versionhash') back into the top of the .mix file and ran an npm watch so temp solution of #29 is now not necessary.

roelofr commented 4 years ago

@roelofr @terryupton could u plz try the latest version with ur setup & reply back if u still need the temp solution of https://github.com/ctf0/laravel-mix-versionhash/issues/29#issuecomment-554373375 ?

I've long since switched away from Laravel Mix in favour of a vanilla Webpack config.

You should take @terryupton's feedback as leading here.

ctf0 commented 4 years ago

@terryupton awesome thanx. @roelofr np.