1. Install the yarn add browser-sync –dev plug-in

2. Import the file in gulpfile.js

const browserSync = require('browser-sync') const bs = browserSync.create() const serve = () => { Watch (' SRC /assets/styles/*.scss', style) Watch (' SRC /assets/scripts/*.js', script) watch(' SRC /*.html', // watch(' SRC /assets/images/**', image) // watch(' SRC /assets/fonts/**', Font) // watch('public/**', extra) Watch ([' SRC /assets/images/**', 'SRC /assets/fonts/**', 'public/**'], bs.reload) bs.init({notify: False, // a little prompt in the upper right corner port: 2080, // port open: false, // Automatically open the browser files: ", // Automatically update the browser server: {baseDir: ['dist', 'SRC ', 'public'] // routes: {// routes '/node_modules': 'node_modules'}}})} const compile = parallel(style, script, Const build = parallel(compile, image, font, extra) const develop = series(compile, serve) module.exports = { compile, build, serve, develop }Copy the code

3. Run yarn gulp serve