Use absolute path for webworker scripts

This commit is contained in:
dannyrb 2019-04-30 16:11:06 -04:00
parent 4cecdcc3dc
commit 686f613fd0
2 changed files with 4 additions and 2 deletions

View File

@ -18,7 +18,7 @@
"dev": "yarn run preBuild && cross-env PORT=5000 react-scripts start",
"dev:debug": "cross-env PORT=5000 react-scripts start",
"build:package": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",
"build:package:ci": "yarn run preBuild && cross-env REACT_APP_CONFIG=config/default.js node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",
"build:package:ci": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",
"build:web": "yarn run preBuild && react-scripts --max_old_space_size=4096 build",
"build:web:ci": "yarn run preBuild && cross-env PUBLIC_URL=/demo REACT_APP_CONFIG=config/netlify.js react-scripts --max_old_space_size=4096 build && cpx 'build/**/*' docs/latest/_book/demo --verbose",
"lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}",

View File

@ -6,7 +6,9 @@ import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
* @param {String} webWorkScriptsPath
*/
export default function(baseDirectory, webWorkScriptsPath) {
const scriptsPath = `${baseDirectory}/${webWorkScriptsPath}`
const scriptsPath = `${window.location.protocol}//${
window.location.host
}${baseDirectory}/${webWorkScriptsPath}`
const config = {
maxWebWorkers: Math.max(navigator.hardwareConcurrency - 1, 1),
startWebWorkersOnDemand: true,