Merge pull request #411 from dannyrb/deploying-static-site-2
fix webworkers
This commit is contained in:
commit
fd3c8161f7
@ -1,7 +1,7 @@
|
||||
##
|
||||
# DEVELOPMENT: Default
|
||||
# Environment: Default
|
||||
#
|
||||
# We're using this to set variables for our local development.
|
||||
# We're using this to set variables for development.
|
||||
# Please feel free to delete or modify this file for your own setup.
|
||||
# Be careful not to commit anything sensitive to source control.
|
||||
#
|
||||
13
.env.example
Normal file
13
.env.example
Normal file
@ -0,0 +1,13 @@
|
||||
##
|
||||
# EXAMPLE
|
||||
#
|
||||
# Read more about .env files when using create-react-app here:
|
||||
# https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#adding-development-environment-variables-in-env
|
||||
#
|
||||
|
||||
PUBLIC_URL=/demo
|
||||
|
||||
#
|
||||
# Most vars require REACT_APP_* naming
|
||||
#
|
||||
REACT_APP_CONFIG=config/netlify.js
|
||||
@ -1,14 +0,0 @@
|
||||
##
|
||||
# PRODUCTION: Netlify
|
||||
#
|
||||
# We're using this to set variables for our Netlify deploy.
|
||||
# Please feel free to delete or modify this file for your own production
|
||||
# environment. Be careful not to commit anything sensitive to source control.
|
||||
#
|
||||
|
||||
PUBLIC_URL=/demo
|
||||
|
||||
#
|
||||
# Most vars require REACT_APP_* naming
|
||||
#
|
||||
REACT_APP_CONFIG=config/netlify.js
|
||||
@ -70,15 +70,18 @@ how to configure the project for your own imaging archive below.
|
||||
> ["Set up a local DICOM server"](./../../essentials/getting-started.md#set-up-a-local-dicom-server),
|
||||
> or a deployment recipe that contains an open source Image Archive
|
||||
|
||||
#### How It Works
|
||||
#### How it Works
|
||||
|
||||
The configuration for our project is in the `/public/config` directory. Our
|
||||
build process knows which configuration file to use based on the
|
||||
`REACT_APP_CONFIG` environment variable. By default, its value is
|
||||
[`default.js`](https://github.com/OHIF/Viewers/blob/react/public/config/default.js).
|
||||
When we build, the `%REACT_APP_CONFIG%` value in
|
||||
our[`/public/index.html`](https://github.com/OHIF/Viewers/blob/react/public/index.html#L12-L15)`file is substituted for the correct configuration file's name. Ultimately setting the`window.config`
|
||||
equal to our configuration file's value.
|
||||
our[`/public/index.html`](https://github.com/OHIF/Viewers/blob/react/public/index.html#L12-L15)
|
||||
file is substituted for the correct configuration file's name. This sets
|
||||
the`window.config` equal to our configuration file's value.
|
||||
|
||||
#### How do I configure my project?
|
||||
|
||||
- Modify its values directly
|
||||
- Create a new config file, and set the `REACT_APP_CONFIG` environement variable
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
"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 && react-scripts --max_old_space_size=4096 build && cpx 'build/**/*' docs/latest/_book/demo --verbose",
|
||||
"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}",
|
||||
"test": "jest",
|
||||
"test:ci": "jest --ci --runInBand --collectCoverage --reporters=default --reporters=jest-junit && codecov",
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user