Couch object provider performance improvement using SharedWorker (#3993)

* Use the window SharedWorker instead of the WorkerService
* Use relative asset path for Shared Workers
* Remove beforeunload listener on destroy
This commit is contained in:
Shefali Joshi
2021-07-30 15:23:02 -07:00
committed by GitHub
parent 9b7a0d7e4c
commit b329ed6ed5
4 changed files with 225 additions and 19 deletions

View File

@ -14,19 +14,21 @@ const gitRevision = require('child_process')
const gitBranch = require('child_process')
.execSync('git rev-parse --abbrev-ref HEAD')
.toString().trim();
const vueFile = devMode ?
path.join(__dirname, "node_modules/vue/dist/vue.js") :
path.join(__dirname, "node_modules/vue/dist/vue.min.js");
const vueFile = devMode
? path.join(__dirname, "node_modules/vue/dist/vue.js")
: path.join(__dirname, "node_modules/vue/dist/vue.min.js");
const webpackConfig = {
mode: devMode ? 'development' : 'production',
entry: {
openmct: './openmct.js',
couchDBChangesFeed: './src/plugins/persistence/couch/CouchChangesFeed.js',
espressoTheme: './src/plugins/themes/espresso-theme.scss',
snowTheme: './src/plugins/themes/snow-theme.scss',
maelstromTheme: './src/plugins/themes/maelstrom-theme.scss'
},
output: {
globalObject: "this",
filename: '[name].js',
library: '[name]',
libraryTarget: 'umd',
@ -105,13 +107,15 @@ const webpackConfig = {
name: '[name].[ext]',
outputPath(url, resourcePath, context) {
if (/\.(jpg|jpeg|png|svg)$/.test(url)) {
return `images/${url}`
return `images/${url}`;
}
if (/\.ico$/.test(url)) {
return `icons/${url}`
return `icons/${url}`;
}
if (/\.(woff2?|eot|ttf)$/.test(url)) {
return `fonts/${url}`
return `fonts/${url}`;
} else {
return `${url}`;
}