chore: Upgrade to webpack 5, fix conflicting issues with react-router under docusaurus with yarn workspaces
This commit is contained in:
parent
de412f2eef
commit
825e13bcf3
@ -14,7 +14,6 @@ const TerserJSPlugin = require('terser-webpack-plugin');
|
|||||||
const NODE_ENV = process.env.NODE_ENV;
|
const NODE_ENV = process.env.NODE_ENV;
|
||||||
const QUICK_BUILD = process.env.QUICK_BUILD;
|
const QUICK_BUILD = process.env.QUICK_BUILD;
|
||||||
const BUILD_NUM = process.env.CIRCLE_BUILD_NUM || '0';
|
const BUILD_NUM = process.env.CIRCLE_BUILD_NUM || '0';
|
||||||
const { UnusedFilesWebpackPlugin } = require("unused-files-webpack-plugin");
|
|
||||||
|
|
||||||
//
|
//
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
@ -30,7 +29,7 @@ module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => {
|
|||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
mode: isProdBuild ? 'production' : 'development',
|
mode: isProdBuild ? 'production' : 'development',
|
||||||
devtool: isProdBuild ? 'source-map' : 'cheap-module-eval-source-map',
|
devtool: isProdBuild ? 'source-map' : 'eval',
|
||||||
entry: {
|
entry: {
|
||||||
app: `${SRC_DIR}/index.js`,
|
app: `${SRC_DIR}/index.js`,
|
||||||
},
|
},
|
||||||
@ -55,9 +54,16 @@ module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => {
|
|||||||
transpileJavaScriptRule(mode),
|
transpileJavaScriptRule(mode),
|
||||||
loadWebWorkersRule,
|
loadWebWorkersRule,
|
||||||
loadShadersRule,
|
loadShadersRule,
|
||||||
|
{
|
||||||
|
test: /\.m?js/,
|
||||||
|
resolve: {
|
||||||
|
fullySpecified: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
mainFields: ['browser', 'module', 'main'],
|
||||||
alias: {
|
alias: {
|
||||||
// Viewer project
|
// Viewer project
|
||||||
'@': path.resolve(__dirname, '../platform/viewer/src'),
|
'@': path.resolve(__dirname, '../platform/viewer/src'),
|
||||||
@ -81,6 +87,7 @@ module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => {
|
|||||||
extensions: ['.js', '.jsx', '.json', '*'],
|
extensions: ['.js', '.jsx', '.json', '*'],
|
||||||
// symlinked resources are resolved to their real path, not their symlinked location
|
// symlinked resources are resolved to their real path, not their symlinked location
|
||||||
symlinks: true,
|
symlinks: true,
|
||||||
|
fallback: { fs: false, path: false },
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
@ -89,7 +96,9 @@ module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => {
|
|||||||
'process.env.DEBUG': JSON.stringify(process.env.DEBUG),
|
'process.env.DEBUG': JSON.stringify(process.env.DEBUG),
|
||||||
'process.env.APP_CONFIG': JSON.stringify(process.env.APP_CONFIG || ''),
|
'process.env.APP_CONFIG': JSON.stringify(process.env.APP_CONFIG || ''),
|
||||||
'process.env.PUBLIC_URL': JSON.stringify(process.env.PUBLIC_URL || '/'),
|
'process.env.PUBLIC_URL': JSON.stringify(process.env.PUBLIC_URL || '/'),
|
||||||
'process.env.VERSION_NUMBER': JSON.stringify(process.env.VERSION_NUMBER || PACKAGE.version || ''),
|
'process.env.VERSION_NUMBER': JSON.stringify(
|
||||||
|
process.env.VERSION_NUMBER || PACKAGE.version || ''
|
||||||
|
),
|
||||||
'process.env.BUILD_NUM': JSON.stringify(BUILD_NUM),
|
'process.env.BUILD_NUM': JSON.stringify(BUILD_NUM),
|
||||||
/* i18n */
|
/* i18n */
|
||||||
'process.env.USE_LOCIZE': JSON.stringify(process.env.USE_LOCIZE || ''),
|
'process.env.USE_LOCIZE': JSON.stringify(process.env.USE_LOCIZE || ''),
|
||||||
@ -99,25 +108,16 @@ module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => {
|
|||||||
'process.env.LOCIZE_API_KEY': JSON.stringify(
|
'process.env.LOCIZE_API_KEY': JSON.stringify(
|
||||||
process.env.LOCIZE_API_KEY || ''
|
process.env.LOCIZE_API_KEY || ''
|
||||||
),
|
),
|
||||||
}),
|
'process.env.REACT_APP_I18N_DEBUG': JSON.stringify(
|
||||||
new UnusedFilesWebpackPlugin({
|
process.env.REACT_APP_I18N_DEBUG || ''
|
||||||
failOnUnused: false,
|
),
|
||||||
globOptions: {
|
|
||||||
ignore: [
|
|
||||||
"node_modules/**/*",
|
|
||||||
"index.umd.js",
|
|
||||||
"sanity.test.js",
|
|
||||||
"__mocks__/fileMock.js",
|
|
||||||
"__tests__/globalSetup.js"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
// Fix: https://github.com/webpack-contrib/css-loader/issues/447#issuecomment-285598881
|
// Fix: https://github.com/webpack-contrib/css-loader/issues/447#issuecomment-285598881
|
||||||
// For issue in cornerstone-wado-image-loader
|
// For issue in cornerstone-wado-image-loader
|
||||||
node: {
|
/*node: {
|
||||||
fs: 'empty',
|
fs: 'empty',
|
||||||
},
|
},*/
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isProdBuild) {
|
if (isProdBuild) {
|
||||||
|
|||||||
@ -39,8 +39,8 @@
|
|||||||
"dicom-parser": "^1.8.3",
|
"dicom-parser": "^1.8.3",
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^16.11.0",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^16.11.0",
|
"react-dom": "^17.0.2",
|
||||||
"react-resize-detector": "^3.4.0"
|
"react-resize-detector": "^3.4.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -35,7 +35,9 @@
|
|||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.1",
|
||||||
"react-i18next": "^10.11.0",
|
"react-i18next": "^10.11.0",
|
||||||
"webpack": "^4.0.0",
|
"react-router": "next",
|
||||||
|
"react-router-dom": "next",
|
||||||
|
"webpack": "^5.43.0",
|
||||||
"webpack-merge": "^5.7.3"
|
"webpack-merge": "^5.7.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
|
|
||||||
import i18n from '@ohif/i18n';
|
import i18n from '@ohif/i18n';
|
||||||
import { hotkeys } from '@ohif/core';
|
import { hotkeys } from '@ohif/core';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
const { availableLanguages, defaultLanguage, currentLanguage } = i18n;
|
const { availableLanguages, defaultLanguage, currentLanguage } = i18n;
|
||||||
|
|
||||||
@ -91,6 +91,11 @@ function ViewerLayout({
|
|||||||
ViewportGridComp,
|
ViewportGridComp,
|
||||||
}) {
|
}) {
|
||||||
const [appConfig] = useAppConfig();
|
const [appConfig] = useAppConfig();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const onClickReturnButton = () => {
|
||||||
|
navigate('/')
|
||||||
|
};
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { show, hide } = useModal();
|
const { show, hide } = useModal();
|
||||||
@ -176,7 +181,7 @@ function ViewerLayout({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Header menuOptions={menuOptions} WhiteLabeling={appConfig.whiteLabeling} >
|
<Header menuOptions={menuOptions} onClickReturnButton={onClickReturnButton} WhiteLabeling={appConfig.whiteLabeling} >
|
||||||
<ErrorBoundary context="Primary Toolbar">
|
<ErrorBoundary context="Primary Toolbar">
|
||||||
<div className="relative flex justify-center">
|
<div className="relative flex justify-center">
|
||||||
<Toolbar servicesManager={servicesManager} />
|
<Toolbar servicesManager={servicesManager} />
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
"dicom-parser": "^1.8.3",
|
"dicom-parser": "^1.8.3",
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^16.11.0",
|
"react": "^17.0.2",
|
||||||
"react-cornerstone-viewport": "4.0.5"
|
"react-cornerstone-viewport": "4.0.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
"react-cornerstone-viewport": "^4.0.5",
|
"react-cornerstone-viewport": "^4.0.5",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.1",
|
||||||
"webpack": "^4.0.0",
|
"webpack": "^5.43.0",
|
||||||
"webpack-merge": "^5.7.3"
|
"webpack-merge": "^5.7.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
"@babel/runtime": "7.7.6"
|
"@babel/runtime": "7.7.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"webpack": "^5.21.2",
|
"webpack": "^5.43.0",
|
||||||
"webpack-merge": "^5.7.3"
|
"webpack-merge": "^5.7.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
27
package.json
27
package.json
@ -32,7 +32,6 @@
|
|||||||
"test:unit": "jest --collectCoverage",
|
"test:unit": "jest --collectCoverage",
|
||||||
"test:unit:ci": "lerna run test:unit:ci --parallel --stream",
|
"test:unit:ci": "lerna run test:unit:ci --parallel --stream",
|
||||||
"test:e2e": "lerna run test:e2e --stream",
|
"test:e2e": "lerna run test:e2e --stream",
|
||||||
"test:e2e:script-tag": "lerna run test:e2e:script-tag --stream",
|
|
||||||
"test:e2e:ci": "lerna run test:e2e:ci --stream",
|
"test:e2e:ci": "lerna run test:e2e:ci --stream",
|
||||||
"test:e2e:dist": "lerna run test:e2e:dist --stream",
|
"test:e2e:dist": "lerna run test:e2e:dist --stream",
|
||||||
"test:e2e:serve": "lerna run test:e2e:serve --stream",
|
"test:e2e:serve": "lerna run test:e2e:serve --stream",
|
||||||
@ -50,11 +49,11 @@
|
|||||||
"@babel/runtime": "7.7.6",
|
"@babel/runtime": "7.7.6",
|
||||||
"core-js": "^3.2.1",
|
"core-js": "^3.2.1",
|
||||||
"cornerstone-core": "2.3.0",
|
"cornerstone-core": "2.3.0",
|
||||||
"react": "16.11.0",
|
"react": "17.0.2",
|
||||||
"react-dom": "16.11.0",
|
"react-dom": "17.0.2",
|
||||||
"shader-loader": "^1.3.1",
|
"shader-loader": "^1.3.1",
|
||||||
"webpack": "^4.35.2",
|
"webpack": "^5.43.0",
|
||||||
"worker-loader": "^2.0.0",
|
"worker-loader": "^3.0.8",
|
||||||
"wslink": "^0.1.8"
|
"wslink": "^0.1.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -73,7 +72,7 @@
|
|||||||
"babel-plugin-inline-react-svg": "1.1.0",
|
"babel-plugin-inline-react-svg": "1.1.0",
|
||||||
"babel-plugin-module-resolver": "^3.2.0",
|
"babel-plugin-module-resolver": "^3.2.0",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
"copy-webpack-plugin": "^5.0.3",
|
"copy-webpack-plugin": "^9.0.1",
|
||||||
"cross-env": "^5.2.0",
|
"cross-env": "^5.2.0",
|
||||||
"css-loader": "^3.2.0",
|
"css-loader": "^3.2.0",
|
||||||
"dotenv": "^8.1.0",
|
"dotenv": "^8.1.0",
|
||||||
@ -88,8 +87,8 @@
|
|||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
"eslint-plugin-react": "7.x",
|
"eslint-plugin-react": "7.x",
|
||||||
"eslint-plugin-react-hooks": "4.2.0",
|
"eslint-plugin-react-hooks": "4.2.0",
|
||||||
"extract-css-chunks-webpack-plugin": "^4.5.4",
|
"extract-css-chunks-webpack-plugin": "^4.9.0",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"html-webpack-plugin": "^5.3.2",
|
||||||
"husky": "^3.0.0",
|
"husky": "^3.0.0",
|
||||||
"jest": "^24.8.0",
|
"jest": "^24.8.0",
|
||||||
"jest-canvas-mock": "^2.1.0",
|
"jest-canvas-mock": "^2.1.0",
|
||||||
@ -102,18 +101,16 @@
|
|||||||
"postcss-loader": "^4.0.3",
|
"postcss-loader": "^4.0.3",
|
||||||
"postcss-preset-env": "^6.6.0",
|
"postcss-preset-env": "^6.6.0",
|
||||||
"prettier": "^1.18.2",
|
"prettier": "^1.18.2",
|
||||||
"react-hot-loader": "^4.12.21",
|
"react-hot-loader": "^4.13.0",
|
||||||
"serve": "^11.1.0",
|
"serve": "^11.1.0",
|
||||||
"start-server-and-test": "^1.10.0",
|
"start-server-and-test": "^1.10.0",
|
||||||
"style-loader": "^1.0.0",
|
"style-loader": "^1.0.0",
|
||||||
"terser-webpack-plugin": "^2.1.0",
|
"terser-webpack-plugin": "^5.1.4",
|
||||||
"unused-files-webpack-plugin": "^3.4.0",
|
|
||||||
"unused-webpack-plugin": "2.4.0",
|
"unused-webpack-plugin": "2.4.0",
|
||||||
"webpack-cli": "^3.3.5",
|
"webpack-cli": "^4.7.2",
|
||||||
"webpack-dev-server": "^3.7.2",
|
|
||||||
"webpack-hot-middleware": "^2.25.0",
|
"webpack-hot-middleware": "^2.25.0",
|
||||||
"webpack-merge": "^4.2.1",
|
"webpack-merge": "^5.7.3",
|
||||||
"workbox-webpack-plugin": "^5.0.0-beta.1"
|
"workbox-webpack-plugin": "^6.1.5"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
|||||||
@ -16,8 +16,8 @@ const serviceImplementation = {
|
|||||||
_getState: () => console.warn('getState() NOT IMPLEMENTED'),
|
_getState: () => console.warn('getState() NOT IMPLEMENTED'),
|
||||||
_setUser: () => console.warn('_setUser() NOT IMPLEMENTED'),
|
_setUser: () => console.warn('_setUser() NOT IMPLEMENTED'),
|
||||||
_getUser: () => console.warn('_setUser() NOT IMPLEMENTED'),
|
_getUser: () => console.warn('_setUser() NOT IMPLEMENTED'),
|
||||||
_getAuthorizationHeader: () =>
|
_getAuthorizationHeader: () => {}, // TODO: have enabled/disabled state?
|
||||||
console.warn('_getAuthorizationHeader() NOT IMPLEMENTED'),
|
//console.warn('_getAuthorizationHeader() NOT IMPLEMENTED'),
|
||||||
_handleUnauthenticated: () =>
|
_handleUnauthenticated: () =>
|
||||||
console.warn('_handleUnauthenticated() NOT IMPLEMENTED'),
|
console.warn('_handleUnauthenticated() NOT IMPLEMENTED'),
|
||||||
_reset: () => console.warn('reset() NOT IMPLEMENTED'),
|
_reset: () => console.warn('reset() NOT IMPLEMENTED'),
|
||||||
|
|||||||
@ -2,6 +2,16 @@
|
|||||||
"name": "ohif-docs",
|
"name": "ohif-docs",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"workspaces": {
|
||||||
|
"nohoist": [
|
||||||
|
"@docusaurus/core/**",
|
||||||
|
"@docusaurus/core",
|
||||||
|
"@docusaurus/preset-classic",
|
||||||
|
"@docusaurus/preset-classic/**",
|
||||||
|
"**/react-router-dom",
|
||||||
|
"**/react-router"
|
||||||
|
]
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docusaurus": "docusaurus",
|
"docusaurus": "docusaurus",
|
||||||
"start": "docusaurus start --port 8001",
|
"start": "docusaurus start --port 8001",
|
||||||
@ -30,8 +40,8 @@
|
|||||||
"url-loader": "^4.1.1"
|
"url-loader": "^4.1.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.11.0",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^16.11.0"
|
"react-dom": "^17.0.2"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
|||||||
@ -31,8 +31,8 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"i18next": "^17.0.3",
|
"i18next": "^17.0.3",
|
||||||
"i18next-browser-languagedetector": "^3.0.1",
|
"i18next-browser-languagedetector": "^3.0.1",
|
||||||
"react": "^16.11.0",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^16.11.0",
|
"react-dom": "^17.0.2",
|
||||||
"react-i18next": "^10.11.0"
|
"react-i18next": "^10.11.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -44,8 +44,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"i18next": "^17.0.3",
|
"i18next": "^17.0.3",
|
||||||
"i18next-browser-languagedetector": "^3.0.1",
|
"i18next-browser-languagedetector": "^3.0.1",
|
||||||
"react": "^16.11.0",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^16.11.0",
|
"react-dom": "^17.0.2",
|
||||||
"react-i18next": "^10.11.0",
|
"react-i18next": "^10.11.0",
|
||||||
"webpack-merge": "^5.7.3"
|
"webpack-merge": "^5.7.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,11 +32,11 @@
|
|||||||
"classnames": "2.2.6",
|
"classnames": "2.2.6",
|
||||||
"lodash.debounce": "4.0.8",
|
"lodash.debounce": "4.0.8",
|
||||||
"moment": "2.24.0",
|
"moment": "2.24.0",
|
||||||
"react": "16.11.0",
|
"react": "17.0.2",
|
||||||
"react-dates": "^21.8.0",
|
"react-dates": "^21.8.0",
|
||||||
"react-dnd": "10.0.2",
|
"react-dnd": "14.0.2",
|
||||||
"react-dnd-html5-backend": "10.0.2",
|
"react-dnd-html5-backend": "14.0.0",
|
||||||
"react-dom": "16.11.0",
|
"react-dom": "17.0.2",
|
||||||
"react-draggable": "4.4.3",
|
"react-draggable": "4.4.3",
|
||||||
"react-error-boundary": "^3.1.3",
|
"react-error-boundary": "^3.1.3",
|
||||||
"react-modal": "3.11.2",
|
"react-modal": "3.11.2",
|
||||||
|
|||||||
@ -2,19 +2,16 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
// TODO: This may fail if package is split from PWA build
|
|
||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
import { NavBar, Svg, Icon, IconButton, Dropdown } from '@ohif/ui';
|
import { NavBar, Svg, Icon, IconButton, Dropdown } from '@ohif/ui';
|
||||||
|
|
||||||
function Header({ children, menuOptions, isReturnEnabled, isSticky, WhiteLabeling }) {
|
function Header({ children, menuOptions, isReturnEnabled, onClickReturnButton, isSticky, WhiteLabeling }) {
|
||||||
const { t } = useTranslation('Header');
|
const { t } = useTranslation('Header');
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
// TODO: this should be passed in as a prop instead and the react-router-dom
|
// TODO: this should be passed in as a prop instead and the react-router-dom
|
||||||
// dependency should be dropped
|
// dependency should be dropped
|
||||||
const onReturnHandler = () => {
|
const onClickReturn = () => {
|
||||||
if (isReturnEnabled) {
|
if (isReturnEnabled && onClickReturnButton) {
|
||||||
navigate('/');
|
onClickReturnButton()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -30,7 +27,7 @@ function Header({ children, menuOptions, isReturnEnabled, isSticky, WhiteLabelin
|
|||||||
// Either injected service? Or context (like react router's `useLocation`?) */}
|
// Either injected service? Or context (like react router's `useLocation`?) */}
|
||||||
<div
|
<div
|
||||||
className={classNames("inline-flex items-center mr-3", isReturnEnabled && 'cursor-pointer')}
|
className={classNames("inline-flex items-center mr-3", isReturnEnabled && 'cursor-pointer')}
|
||||||
onClick={onReturnHandler}
|
onClick={onClickReturn}
|
||||||
>
|
>
|
||||||
{isReturnEnabled && <Icon name="chevron-left" className="w-8 text-primary-active" />}
|
{isReturnEnabled && <Icon name="chevron-left" className="w-8 text-primary-active" />}
|
||||||
<div className="ml-4">{WhiteLabeling ? CustomLogo(React) : <Svg name="logo-ohif" />}</div>
|
<div className="ml-4">{WhiteLabeling ? CustomLogo(React) : <Svg name="logo-ohif" />}</div>
|
||||||
@ -78,6 +75,7 @@ Header.propTypes = {
|
|||||||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
||||||
isReturnEnabled: PropTypes.bool,
|
isReturnEnabled: PropTypes.bool,
|
||||||
isSticky: PropTypes.bool,
|
isSticky: PropTypes.bool,
|
||||||
|
onClickReturnButton: PropTypes.func,
|
||||||
WhiteLabeling: PropTypes.element,
|
WhiteLabeling: PropTypes.element,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ const Thumbnail = ({
|
|||||||
// this will still allow for "drag", even if there is no drop target for the
|
// this will still allow for "drag", even if there is no drop target for the
|
||||||
// specified item.
|
// specified item.
|
||||||
const [collectedProps, drag, dragPreview] = useDrag({
|
const [collectedProps, drag, dragPreview] = useDrag({
|
||||||
|
type: "displayset",
|
||||||
item: { ...dragData },
|
item: { ...dragData },
|
||||||
canDrag: function(monitor) {
|
canDrag: function(monitor) {
|
||||||
return Object.keys(dragData).length !== 0;
|
return Object.keys(dragData).length !== 0;
|
||||||
|
|||||||
@ -18,6 +18,7 @@ const ThumbnailNoImage = ({
|
|||||||
isActive,
|
isActive,
|
||||||
}) => {
|
}) => {
|
||||||
const [collectedProps, drag, dragPreview] = useDrag({
|
const [collectedProps, drag, dragPreview] = useDrag({
|
||||||
|
type: "displayset",
|
||||||
item: { ...dragData },
|
item: { ...dragData },
|
||||||
canDrag: function(monitor) {
|
canDrag: function(monitor) {
|
||||||
return Object.keys(dragData).length !== 0;
|
return Object.keys(dragData).length !== 0;
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { DndProvider } from 'react-dnd';
|
import { DndProvider } from 'react-dnd';
|
||||||
import HTML5Backend from 'react-dnd-html5-backend';
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
||||||
|
|
||||||
// import TouchBackend from 'react-dnd-touch-backend';
|
// import TouchBackend from 'react-dnd-touch-backend';
|
||||||
|
|
||||||
// TODO: this is false when it should not be :thinking:
|
// TODO: this is false when it should not be :thinking:
|
||||||
|
|||||||
@ -27,6 +27,8 @@ const PROXY_DOMAIN = process.env.PROXY_DOMAIN;
|
|||||||
const ENTRY_TARGET = process.env.ENTRY_TARGET || `${SRC_DIR}/index.js`;
|
const ENTRY_TARGET = process.env.ENTRY_TARGET || `${SRC_DIR}/index.js`;
|
||||||
const Dotenv = require('dotenv-webpack');
|
const Dotenv = require('dotenv-webpack');
|
||||||
|
|
||||||
|
console.warn(path.resolve(__dirname, '../node_modules'));
|
||||||
|
|
||||||
module.exports = (env, argv) => {
|
module.exports = (env, argv) => {
|
||||||
const baseConfig = webpackBase(env, argv, { SRC_DIR, DIST_DIR });
|
const baseConfig = webpackBase(env, argv, { SRC_DIR, DIST_DIR });
|
||||||
const isProdBuild = process.env.NODE_ENV === 'production';
|
const isProdBuild = process.env.NODE_ENV === 'production';
|
||||||
@ -44,6 +46,15 @@ module.exports = (env, argv) => {
|
|||||||
module: {
|
module: {
|
||||||
rules: [...extractStyleChunksRule(isProdBuild)],
|
rules: [...extractStyleChunksRule(isProdBuild)],
|
||||||
},
|
},
|
||||||
|
resolve: {
|
||||||
|
modules: [
|
||||||
|
// Modules specific to this package
|
||||||
|
path.resolve(__dirname, '../node_modules'),
|
||||||
|
// Hoisted Yarn Workspace Modules
|
||||||
|
path.resolve(__dirname, '../../../node_modules'),
|
||||||
|
SRC_DIR,
|
||||||
|
],
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new Dotenv(),
|
new Dotenv(),
|
||||||
// Uncomment to generate bundle analyzer
|
// Uncomment to generate bundle analyzer
|
||||||
@ -51,27 +62,31 @@ module.exports = (env, argv) => {
|
|||||||
// Clean output.path
|
// Clean output.path
|
||||||
new CleanWebpackPlugin(),
|
new CleanWebpackPlugin(),
|
||||||
// Copy "Public" Folder to Dist
|
// Copy "Public" Folder to Dist
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin({
|
||||||
{
|
patterns: [
|
||||||
from: PUBLIC_DIR,
|
{
|
||||||
to: DIST_DIR,
|
from: PUBLIC_DIR,
|
||||||
toType: 'dir',
|
to: DIST_DIR,
|
||||||
// Ignore our HtmlWebpackPlugin template file
|
toType: 'dir',
|
||||||
// Ignore our configuration files
|
globOptions: {
|
||||||
ignore: ['config/*', 'html-templates/*', '.DS_Store'],
|
// Ignore our HtmlWebpackPlugin template file
|
||||||
},
|
// Ignore our configuration files
|
||||||
// Short term solution to make sure GCloud config is available in output
|
ignore: ['config/*', 'html-templates/*', '.DS_Store'],
|
||||||
// for our docker implementation
|
},
|
||||||
{
|
},
|
||||||
from: `${PUBLIC_DIR}/config/google.js`,
|
// Short term solution to make sure GCloud config is available in output
|
||||||
to: `${DIST_DIR}/google.js`,
|
// for our docker implementation
|
||||||
},
|
{
|
||||||
// Copy over and rename our target app config file
|
from: `${PUBLIC_DIR}/config/google.js`,
|
||||||
{
|
to: `${DIST_DIR}/google.js`,
|
||||||
from: `${PUBLIC_DIR}/${APP_CONFIG}`,
|
},
|
||||||
to: `${DIST_DIR}/app-config.js`,
|
// Copy over and rename our target app config file
|
||||||
},
|
{
|
||||||
]),
|
from: `${PUBLIC_DIR}/${APP_CONFIG}`,
|
||||||
|
to: `${DIST_DIR}/app-config.js`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
// https://github.com/faceyspacey/extract-css-chunks-webpack-plugin#webpack-4-standalone-installation
|
// https://github.com/faceyspacey/extract-css-chunks-webpack-plugin#webpack-4-standalone-installation
|
||||||
new ExtractCssChunksPlugin({
|
new ExtractCssChunksPlugin({
|
||||||
filename: isProdBuild ? '[name].[hash].css' : '[name].css',
|
filename: isProdBuild ? '[name].[hash].css' : '[name].css',
|
||||||
|
|||||||
@ -20,13 +20,12 @@
|
|||||||
"build:viewer": "cross-env NODE_ENV=production node --max_old_space_size=4096 ./../../node_modules/webpack/bin/webpack.js --config .webpack/webpack.pwa.js --progress",
|
"build:viewer": "cross-env NODE_ENV=production node --max_old_space_size=4096 ./../../node_modules/webpack/bin/webpack.js --config .webpack/webpack.pwa.js --progress",
|
||||||
"build:viewer:ci": "cross-env NODE_ENV=production PUBLIC_URL=/ APP_CONFIG=config/netlify.js QUICK_BUILD=true node --max_old_space_size=4096 ./../../node_modules/webpack/bin/webpack.js --config .webpack/webpack.pwa.js",
|
"build:viewer:ci": "cross-env NODE_ENV=production PUBLIC_URL=/ APP_CONFIG=config/netlify.js QUICK_BUILD=true node --max_old_space_size=4096 ./../../node_modules/webpack/bin/webpack.js --config .webpack/webpack.pwa.js",
|
||||||
"build:viewer:demo": "cross-env NODE_ENV=production APP_CONFIG=config/demo.js HTML_TEMPLATE=rollbar.html QUICK_BUILD=true node --max_old_space_size=4096 ./../../node_modules/webpack/bin/webpack.js --progress --config .webpack/webpack.pwa.js",
|
"build:viewer:demo": "cross-env NODE_ENV=production APP_CONFIG=config/demo.js HTML_TEMPLATE=rollbar.html QUICK_BUILD=true node --max_old_space_size=4096 ./../../node_modules/webpack/bin/webpack.js --progress --config .webpack/webpack.pwa.js",
|
||||||
"dev": "cross-env NODE_ENV=development webpack-dev-server --config .webpack/webpack.pwa.js --watch",
|
"dev": "cross-env NODE_ENV=development webpack serve --config .webpack/webpack.pwa.js",
|
||||||
"dev:orthanc": "cross-env NODE_ENV=development PROXY_TARGET=/dicom-web PROXY_DOMAIN=http://localhost:8042 APP_CONFIG=config/docker_nginx-orthanc.js webpack-dev-server --config .webpack/webpack.pwa.js --watch",
|
"dev:orthanc": "cross-env NODE_ENV=development PROXY_TARGET=/dicom-web PROXY_DOMAIN=http://localhost:8042 APP_CONFIG=config/docker_nginx-orthanc.js webpack serve --config .webpack/webpack.pwa.js",
|
||||||
"dev:viewer": "yarn run dev",
|
"dev:viewer": "yarn run dev",
|
||||||
"start": "yarn run dev",
|
"start": "yarn run dev",
|
||||||
"test:e2e": "cypress open",
|
"test:e2e": "cypress open",
|
||||||
"test:e2e:ci": "percy exec -- cypress run --config video=false --record --browser chrome --spec 'cypress/integration/visual-regression/**/*'",
|
"test:e2e:ci": "percy exec -- cypress run --config video=false --record --browser chrome --spec 'cypress/integration/visual-regression/**/*'",
|
||||||
"test:e2e:script-tag": "cypress run --config video=false --browser chrome --spec 'cypress/integration/common/**/*,cypress/integration/script-tag/**/*'",
|
|
||||||
"test:e2e:local": "cypress run --config video=false --browser chrome --spec 'cypress/integration/common/**/*,cypress/integration/pwa/**/*'",
|
"test:e2e:local": "cypress run --config video=false --browser chrome --spec 'cypress/integration/common/**/*,cypress/integration/pwa/**/*'",
|
||||||
"test:e2e:dist": "start-server-and-test test:e2e:serve http://localhost:3000 test:e2e:ci",
|
"test:e2e:dist": "start-server-and-test test:e2e:serve http://localhost:3000 test:e2e:ci",
|
||||||
"test:e2e:serve": "serve -n -l 3000 -s dist",
|
"test:e2e:serve": "serve -n -l 3000 -s dist",
|
||||||
@ -40,9 +39,8 @@
|
|||||||
],
|
],
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"cornerstone-core": "^2.3.0",
|
"cornerstone-core": "^2.3.0",
|
||||||
"react": "^16.11.0",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^16.11.0",
|
"react-dom": "^17.0.2"
|
||||||
"webpack": "^4.0.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "7.7.6",
|
"@babel/runtime": "7.7.6",
|
||||||
@ -77,13 +75,15 @@
|
|||||||
"react-router-dom": "next"
|
"react-router-dom": "next"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"webpack": "^5.43.0",
|
||||||
|
"webpack-cli": "^4.7.2",
|
||||||
"@percy/cypress": "^2.3.0",
|
"@percy/cypress": "^2.3.0",
|
||||||
"cypress-file-upload": "^3.5.3",
|
|
||||||
"cypress": "^6.4.0",
|
"cypress": "^6.4.0",
|
||||||
|
"cypress-file-upload": "^3.5.3",
|
||||||
"identity-obj-proxy": "3.0.x",
|
"identity-obj-proxy": "3.0.x",
|
||||||
"lodash": "4.17.15",
|
"lodash": "4.17.15",
|
||||||
"terser-webpack-plugin": "^5.1.1",
|
"terser-webpack-plugin": "^5.1.1",
|
||||||
"webpack-bundle-analyzer": "^3.6.0",
|
"webpack-bundle-analyzer": "^4.4.2",
|
||||||
"webpack-merge": "^5.7.3"
|
"webpack-merge": "^5.7.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
// TODO: replace with HistoryRouter https://github.com/ReactTraining/react-router/pull/7586
|
|
||||||
import { createBrowserHistory, createHashHistory } from 'history';
|
|
||||||
const useHashRouting = JSON.parse(process.env.USE_HASH_ROUTER);
|
|
||||||
const router = useHashRouting ? createHashHistory() : createBrowserHistory();
|
|
||||||
|
|
||||||
export default router;
|
|
||||||
Loading…
Reference in New Issue
Block a user