From 3e3b2a7784017108961e5fe7aa463391d3589673 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 6 Jun 2020 23:03:15 +0200 Subject: [PATCH] Revised webpack bundling and updated worker loading, turned inline worker on by default. --- frontend/gulp/build.js | 3 +-- frontend/gulp/copy.js | 11 ----------- frontend/gulp/webpack.js | 5 ++++- frontend/src/index.html | 1 - frontend/src/index.js | 4 +++- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/frontend/gulp/build.js b/frontend/gulp/build.js index de2da698f..8d036f92e 100644 --- a/frontend/gulp/build.js +++ b/frontend/gulp/build.js @@ -10,8 +10,7 @@ gulp.task('build', 'webpack', 'copyHtml', 'copyFonts', - 'copyImages', - 'copyJs' + 'copyImages' ) ) ); diff --git a/frontend/gulp/copy.js b/frontend/gulp/copy.js index 8d58ac4a4..871c565f6 100644 --- a/frontend/gulp/copy.js +++ b/frontend/gulp/copy.js @@ -5,17 +5,6 @@ const cache = require('gulp-cached'); const livereload = require('gulp-livereload'); const paths = require('./helpers/paths.js'); -gulp.task('copyJs', () => { - return gulp.src( - [ - path.join(paths.src.root, 'polyfills.js') - ], { base: paths.src.root }) - .pipe(cache('copyJs')) - .pipe(print()) - .pipe(gulp.dest(paths.dest.root)) - .pipe(livereload()); -}); - gulp.task('copyHtml', () => { return gulp.src(paths.src.html, { base: paths.src.root }) .pipe(cache('copyHtml')) diff --git a/frontend/gulp/webpack.js b/frontend/gulp/webpack.js index 856d68c7a..c6c5bc2d9 100644 --- a/frontend/gulp/webpack.js +++ b/frontend/gulp/webpack.js @@ -13,6 +13,7 @@ const frontendFolder = path.join(__dirname, '..'); const srcFolder = path.join(frontendFolder, 'src'); const isProduction = process.argv.indexOf('--production') > -1; const isProfiling = isProduction && process.argv.indexOf('--profile') > -1; +const inlineWebWorkers = true; const distFolder = path.resolve(frontendFolder, '..', '_output', uiFolder); @@ -121,7 +122,9 @@ const config = { use: { loader: 'worker-loader', options: { - name: '[name].js' + name: '[name].js', + inline: inlineWebWorkers, + fallback: !inlineWebWorkers } } }, diff --git a/frontend/src/index.html b/frontend/src/index.html index ed138adb0..2745bcd86 100644 --- a/frontend/src/index.html +++ b/frontend/src/index.html @@ -79,6 +79,5 @@ - diff --git a/frontend/src/index.js b/frontend/src/index.js index 015aeee0a..d92a4c646 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -1,4 +1,6 @@ -import './preload.js'; +import './preload'; +import './polyfills'; + import React from 'react'; import { render } from 'react-dom'; import { createBrowserHistory } from 'history';