BrowserSync not starting when watch: true
See original GitHub issueIf I have watch: true
enabled in the webpack config, BrowserSync won’t start for some reason. Note, I don’t have watching enabled in gulp.
JS task:
gulp.task('js', () => {
return gulp.src('')
.pipe(plumber())
.pipe(webpack(webpackConfig))
.on('error', notify.onError({
message: (error) => {
return error.message;
}
}))
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(through.obj(function (file, enc, cb) {
var isSourceMap = /\.map$/.test(file.path);
if (!isSourceMap) this.push(file);
cb();
}))
.pipe(gulp.dest('valamar/static/js/dist/'))
.on('end', reload);
});
Default gulp task:
gulp.task('default', ['sass', 'js'], () => {
browserSync.init({
proxy: 'localhost:8000',
ghostMode: false,
notify: false,
open: false,
ui: false
Webpack config:
watch: true,
devtool: 'source-map',
resolve: {
modulesDirectories: ['node_modules', dir_js]
},
entry: {
vendor: ['jquery'],
app: path.resolve(dir_js, 'app/app.js'),
admin: path.resolve(dir_js, 'admin/admin.js')
},
output: {
path: dir_build,
filename: '[name].js'
},
module: {
loaders: [{
test: /\.js$/,
exclude: /(node_modules|vendor)/,
loader: 'babel-loader'
}]
},
plugins: [
// new webpack.optimize.DedupePlugin(),
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js')
]
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
BrowserSync Not Loading - Stack Overflow
BrowserSync looks for an 'index.html' file to start up and we get the ... watch: true, // <-- Adding this line solved my...
Read more >Browsersync options
Browsersync makes your browser testing workflow faster by synchronising URLs, interactions and code changes across multiple devices.
Read more >BrowserSync keeps reloading infinitely upon JavaScript ...
It was working fine, when I started editing an already existing scss file. Make my changes, save the file and got linter errors,...
Read more >Quick setup for Gulp 4 + Browsersync + Sass - Coder Coder
How to make Browsersync work in your Gulp 4 workflow, with code examples and ... the Browsersync server, and finally running our watch...
Read more >BrowserSync/Live-Server not updating in Gulp File
p>**Expected behavior** BrowserSync/Live Server to reflect all changes made in SaSS, CSS, or JS files.</p> <p>**Actual behavior** Will get stuck on a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zaqqaz A complete example would be lovely.
Just, add handler, and trigger brwser sync from them. Something like that: