-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(script-tag): Include React and ReactDOM as dependencies, add installViewer export #721
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,15 @@ import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'; | |
import dicomParser from 'dicom-parser'; | ||
import version from './version.js'; | ||
|
||
let homepage; | ||
const { process } = window; | ||
if (process && process.env && process.env.PUBLIC_URL) { | ||
homepage = process.env.PUBLIC_URL; | ||
} | ||
|
||
window.info = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're attaching anything to the window with script-tag, you may want to vendor prefix: If only to reduce chances of conflict There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't change anything we are attaching, it just changes how We need to get away from using |
||
version, | ||
homepage: `${process.env.PUBLIC_URL}`, | ||
homepage, | ||
}; | ||
|
||
// For debugging | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,19 @@ | |
* Entry point index.js for rollup packaging | ||
*/ | ||
|
||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
import App from './App.js'; | ||
export { App }; | ||
|
||
function installViewer(props, containerId = "root", callback) { | ||
const container = document.getElementById(containerId); | ||
|
||
if (!container) { | ||
throw new Error("No root element found to install viewer. Please add a <div> with the id 'root', or pass a DOM element into the installViewer function."); | ||
} | ||
|
||
return ReactDOM.render(<App {...props}/>, container, callback); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think users will appreciate this. Thank you 🙌 |
||
|
||
export { App, installViewer }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12489,7 +12489,7 @@ [email protected]: | |
hoist-non-react-statics "^3.3.0" | ||
shallowequal "^1.1.0" | ||
|
||
react-dom@^16.7.0: | ||
react-dom@^16.8.6: | ||
version "16.8.6" | ||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.6.tgz#71d6303f631e8b0097f56165ef608f051ff6e10f" | ||
integrity sha512-1nL7PIq9LTL3fthPqwkvr2zY7phIPjYrT0jp4HjyEQrEROnw4dG41VVwi/wfoCneoleqrNX7iAD+pXebJZwrwA== | ||
|
@@ -12760,7 +12760,7 @@ react-with-styles@^3.2.0: | |
prop-types "^15.6.2" | ||
react-with-direction "^1.3.0" | ||
|
||
react@^16.7.0: | ||
react@^16.8.6: | ||
version "16.8.6" | ||
resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe" | ||
integrity sha512-pC0uMkhLaHm11ZSJULfOBqV4tIZkx87ZLvbbQYunNixAAvjnC+snJCg0XQXn9VIsttVsbZP/H/ewzgsd5fxKXw== | ||
|
@@ -13543,6 +13543,14 @@ rollup-plugin-postcss@^2.0.3: | |
rollup-pluginutils "^2.0.1" | ||
style-inject "^0.3.0" | ||
|
||
rollup-plugin-replace@^2.2.0: | ||
version "2.2.0" | ||
resolved "https://registry.yarnpkg.com/rollup-plugin-replace/-/rollup-plugin-replace-2.2.0.tgz#f41ae5372e11e7a217cde349c8b5d5fd115e70e3" | ||
integrity sha512-/5bxtUPkDHyBJAKketb4NfaeZjL5yLZdeUihSfbF2PQMz+rSTEb8ARKoOl3UBT4m7/X+QOXJo3sLTcq+yMMYTA== | ||
dependencies: | ||
magic-string "^0.25.2" | ||
rollup-pluginutils "^2.6.0" | ||
|
||
rollup-plugin-serve@^1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/rollup-plugin-serve/-/rollup-plugin-serve-1.0.1.tgz#2da2a784a916c5564609c7696cd9dacdbf17f6cc" | ||
|
@@ -13560,7 +13568,7 @@ rollup-plugin-url@^2.2.2: | |
mkpath "^1.0.0" | ||
rollup-pluginutils "^2.8.1" | ||
|
||
rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.8.1: | ||
rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1: | ||
version "2.8.1" | ||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz#8fa6dd0697344938ef26c2c09d2488ce9e33ce97" | ||
integrity sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg== | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird that this is a thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's a pain, I don't know why this is necessary.