BrowserSync / browser-sync

Keep multiple browsers & devices in sync when building websites. https://browsersync.io
https://discord.gg/2d2xUThp
Apache License 2.0
12.19k stars 757 forks source link

Error while using requireJS v2.3.6 #1976

Open metalist1492 opened 2 years ago

metalist1492 commented 2 years ago

Issue details

Please provide issue details here. Error occurs when including requireJS browser-sync-client.js?v=2.27.10:11 Uncaught TypeError: F is not a func

Steps to reproduce/test case

Please provide necessary steps for reproduction of this issue, or better the reduced test case (without any external dependencies).

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

{cli command here}

for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync

{
  "name": "start-gulp",
  "version": "1.0.0",
  "main": "index.js",
  "author": "Vladyslav Lukianov",
  "license": "MIT",
  "dependencies": {},
  "devDependencies": {
    "browser-sync": "^2.27.9",
    "del": "^6.0.0",
    "gulp": "^4.0.2",
    "gulp-autoprefixer": "^8.0.0",
    "gulp-clean-css": "^4.3.0",
    "gulp-concat": "^2.6.1",
    "gulp-imagemin": "7.1",
    "gulp-less": "^5.0.0",
    "gulp-rename": "^2.0.0",
    "gulp-uglify": "^3.0.2",
    "jquery": "^3.6.0"
  }
}
const { src, dest, watch, parallel, series } = require('gulp');
const less = require('gulp-less');
const cleanCSS = require('gulp-clean-css');
const concat = require('gulp-concat');
const autoprefixer = require('gulp-autoprefixer');
const uglify = require('gulp-uglify');
const imagemin = require('gulp-imagemin');
const del = require('del');
const browserSync = require('browser-sync').create();

function browsersync() {
    browserSync.init({
        server: {
            baseDir: 'app/'
        }
    })
}

function styles() {
    return src('app/less/style.less')
        .pipe(less())
        .pipe(cleanCSS())
        .pipe(concat('style.min.css'))
        .pipe(autoprefixer({
            overrideBrowserslist: ['last 10 versions'],
            grid: true
        }))
        .pipe(dest('app/css'))
        .pipe(browserSync.stream())
};

function scripts() {
    return src([
        'node_modules/jquery/dist/jquery.js',
        'app/js/main.js'
    ])
        .pipe(concat('main.min.js'))
        .pipe(uglify())
        .pipe(dest('app/js'))
        .pipe(browserSync.stream())
}

function images() {
    return src('app/images/**/*.*')
        .pipe(imagemin([
            imagemin.gifsicle({ interlaced: true }),
            imagemin.mozjpeg({ quality: 75, progressive: true }),
            imagemin.optipng({ optimizationLevel: 5 }),
            imagemin.svgo({
                plugins: [
                    { removeViewBox: true },
                    { cleanupIDs: false }
                ]
            })
        ]))
        .pipe(dest('dist/images'))
}

function build() {
    return src([
        'app/**/*.html',
        'app/css/style.min.css',
        'app/fonts/**',
        'app/js/main.min.js'
    ], { base: 'app' })
        .pipe(dest('dist'))
}

function cleanDist() {
    return del('dist')
}

function watching() {
    watch(['app/less/**/*.less'], styles);
    watch(['app/js/**/*.js', '!app/js/main.min.js'], scripts);
    watch(['app/**/*.html']).on('change', browserSync.reload);
};

exports.styles = styles;
exports.scripts = scripts;
exports.browsersync = browsersync;
exports.watching = watching;
exports.images = images;
exports.cleanDist = cleanDist;
exports.build = series(cleanDist, images, build);

exports.default = parallel(styles, scripts, browsersync, watching);
salminio commented 2 years ago

We are experiencing the same thing. If it helps here is a stack trace (obfuscated but still somewhat legible) image

      , pm = {
        foreground: "#d3c0c8",
        background: "#2d2d2d",
        black: "#2d2d2d",
        red: "#f2777a",
        green: "#99cc99",
        yellow: "#ffcc66",
        blue: "#6699cc",
        magenta: "#cc99cc",
        cyan: "#66cccc",
        white: "#d3d0c8",
        brightBlack: "#747369"
    }
      , Ts = function() {
        function r(t, e) {
            this.name = t,
            this.opts = e,
            this._name = t || "",
            this._colors = F(F({}, pm), e.colors || {});
            try {
                this.logLevel = window.localStorage.getItem("logLevel") || "info"
            } catch (n) {
                this.logLevel = "info"
            }
            this._logLevel = ks[this.logLevel]
        }