1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix Browsersync JavaScript reload error

This commit is contained in:
MrTimscampi 2020-03-25 21:40:22 +01:00
parent 1c54bdee51
commit 8f1434fa40

View file

@ -18,14 +18,14 @@ const stream = require('webpack-stream');
const inject = require('gulp-inject'); const inject = require('gulp-inject');
const postcss = require('gulp-postcss'); const postcss = require('gulp-postcss');
const sass = require('gulp-sass'); const sass = require('gulp-sass');
sass.compiler = require('node-sass')
sass.compiler = require('node-sass');
var config;
if (mode.production()) { if (mode.production()) {
var config = require('./webpack.prod.js'); config = require('./webpack.prod.js');
} else { } else {
var config = require('./webpack.dev.js'); config = require('./webpack.dev.js');
} }
function serve() { function serve() {
@ -36,20 +36,20 @@ function serve() {
port: 8080 port: 8080
}); });
watch(['src/**/*.js', '!src/bundle.js'], javascript); watch(['src/**/*.js', '!src/bundle.js'], series(javascript, standalone));
watch('src/bundle.js', webpack); watch('src/bundle.js', webpack);
watch('src/**/*.css', css); watch('src/**/*.css', css);
watch(['src/**/*.html', '!src/index.html'], html); watch(['src/**/*.html', '!src/index.html'], html);
watch(['src/**/*.png', 'src/**/*.jpg', 'src/**/*.gif', 'src/**/*.svg'], images); watch(['src/**/*.png', 'src/**/*.jpg', 'src/**/*.gif', 'src/**/*.svg'], images);
watch(['src/**/*.json', 'src/**/*.ico'], copy); watch(['src/**/*.json', 'src/**/*.ico'], copy);
watch('src/index.html', injectBundle); watch('src/index.html', injectBundle);
watch(['src/standalone.js', 'src/scripts/apploader.js'], standalone);
} }
function standalone() { function standalone() {
return src(['src/standalone.js', 'src/scripts/apploader.js'], { base: './src/' }) return src(['src/standalone.js', 'src/scripts/apploader.js'], { base: './src/' })
.pipe(concat('scripts/apploader.js')) .pipe(concat('scripts/apploader.js'))
.pipe(dest('dist/')); .pipe(dest('dist/'))
.pipe(browserSync.stream());
} }
function clean() { function clean() {
@ -70,7 +70,6 @@ function javascript() {
})) }))
.pipe(mode.development(sourcemaps.write('.'))) .pipe(mode.development(sourcemaps.write('.')))
.pipe(dest('dist/')) .pipe(dest('dist/'))
.pipe(browserSync.stream());
} }
function webpack() { function webpack() {
@ -118,6 +117,6 @@ function injectBundle() {
.pipe(browserSync.stream()); .pipe(browserSync.stream());
} }
exports.default = series(clean, parallel(javascript, webpack, css, html, images, copy), injectBundle) exports.default = series(clean, parallel(javascript, webpack, css, html, images, copy), injectBundle);
exports.standalone = series(exports.default, standalone) exports.standalone = series(exports.default, standalone);
exports.serve = series(exports.standalone, serve) exports.serve = series(exports.standalone, serve);