E
E
Efess862021-05-31 12:47:55
Node.js
Efess86, 2021-05-31 12:47:55

Gulp setup. BrowserSync not working?

Good day.
BrowserSync does not want to start.

gives the following message


ReferenceError: wach is not defined
at Object. (C:\Users\kolpa\Desktop\FrontEnd\Projects\Gulp\gulpfile.js:45:19)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions. .js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader .js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at requireOrImport (C:\Users \kolpa\AppData\Roaming\npm\node_modules\gulp-cli\lib\shared\require-or-import.js:19:11)
at execute (C:\Users\kolpa\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^4.0.0\index.js:37:3)
at Liftoff.handleArguments (C:\Users\kolpa \AppData\Roaming\npm\node_modules\gulp-cli\index.js:211:24)


here is gulpfile.js code

let project_folder = "dist";
let source_folder = "#src";
let path = {
  build: {
    html: project_folder + "/",
    css: project_folder + "/css",
    js: project_folder + "/js",
    img: project_folder + "/img",
    fonts: project_folder + "/fonts"
  },
  src: {
    html: source_folder + "/",
    css: source_folder + "/scss/style.scss",
    js: source_folder + "/js/script.js",
    img: source_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}",
    fonts: source_folder + "/fonts/*.ttf"
  },
  watch: {
    html: source_folder + "/**/*.html",
    css: source_folder + "/scss/**/*.scss",
    js: source_folder + "/js/**/*.js",
    img: source_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}"
  },
  clean: "./" + project_folder + "/"
}

let { src, dest } = require('gulp'),
  gulp = require('gulp'),
  browsersync = require("browser-sync").create();

function browserSync(params) {
  browsersync.init({
    server: {
      baseDir: "./" + project_folder + "/"
    },
    port: 3000,
    notify: false
  })
}

let watch = gulp.parallel(browserSync);

exports.watch = watch;
exports.default = wach;


What is wrong I can not understand.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vovash, 2021-05-31
@Efess86

ReferenceError: wach is not defined

exports.default = wach; <- ошибка


exports.default = watch; <- не ошибка

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question