Closed bigfanjs closed 7 years ago
I came up with a couple of solutions:
The first is to use Nodemon which seems to be waiting for the changed files until they actually finish:
{
"scirpts": {
"build:js": "browserify -d src/javascripts/main.js -o dist/bundle.js -t [babelify] -t [uglifyify]",
"watch:js": "watchify -d src/javascripts/main.js -o dist/bundle.js -t [babelify] -t [uglifyify]",
"browsersync": "browser-sync start --server \"dist\"",
"notify": "nodemon --watch dist/ --exec \"browser-sync reload\"",
"watch": "shell-exec \"browsersync\" \"notify\" \"watch:js\""
}
}
The second solution is to give up on all these tools and rather rely on Webpack which provides tons of features out of the box including Hot Module Replacment(HMR) which further resolves the issue.
Issue details
It seems like Browser-sync is not waiting for files changes until they complete. In a case of a building script where it might take some time to bundle a punch of files, Browsersync only detects when we actually save. Once I save it renders a blank page and I have to refresh the browser manually to see the result.
I would be grateful if there is something like this:
Steps to reproduce/test case
Please specify which version of Browsersync, node and npm you're running
Affected platforms
Browsersync use-case
If CLI, please paste the entire command below