-
-
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
feat(OHIF):Allow modes and extensions to be added after compile time. #2838
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ const ENTRY_TARGET = process.env.ENTRY_TARGET || `${SRC_DIR}/index.js`; | |
const Dotenv = require('dotenv-webpack'); | ||
const writePluginImportFile = require('./writePluginImportsFile.js'); | ||
|
||
writePluginImportFile(SRC_DIR); | ||
const copyPluginFromExtensions = writePluginImportFile(SRC_DIR, DIST_DIR); | ||
|
||
const setHeaders = (res, path) => { | ||
if (path.indexOf('.gz') !== -1) { | ||
|
@@ -35,6 +35,8 @@ const setHeaders = (res, path) => { | |
} | ||
if (path.indexOf('.pdf') !== -1) { | ||
res.setHeader('Content-Type', 'application/pdf'); | ||
} else if (path.indexOf('/frames') !== -1) { | ||
res.setHeader('Content-Type', 'multipart/related') | ||
} else { | ||
res.setHeader('Content-Type', 'application/json') | ||
} | ||
|
@@ -77,6 +79,7 @@ module.exports = (env, argv) => { | |
// Copy "Public" Folder to Dist | ||
new CopyWebpackPlugin({ | ||
patterns: [ | ||
...copyPluginFromExtensions, | ||
{ | ||
from: PUBLIC_DIR, | ||
to: DIST_DIR, | ||
|
@@ -108,13 +111,14 @@ module.exports = (env, argv) => { | |
PUBLIC_URL: PUBLIC_URL, | ||
}, | ||
}), | ||
// No longer maintained; but good for generating icons + manifest | ||
// new FaviconsWebpackPlugin( path.join(PUBLIC_DIR, 'assets', 'icons-512.png')), | ||
// Generate a service worker for fast local loads | ||
new InjectManifest({ | ||
swDest: 'sw.js', | ||
swSrc: path.join(SRC_DIR, 'service-worker.js'), | ||
// Increase the limit to 4mb: | ||
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024, | ||
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, | ||
// Need to exclude the theme as it is updated independently | ||
exclude: [/theme/], | ||
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 is required so that themes get reloaded successfully, which is needed for the dynamic imports. |
||
}), | ||
new CopyPlugin({ | ||
patterns: [ | ||
|
@@ -140,16 +144,6 @@ module.exports = (env, argv) => { | |
overlay: { errors: true, warnings: false }, | ||
}, | ||
'static': [ | ||
{ | ||
directory: path.join(require('os').homedir(), 'dicomweb'), | ||
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 was causing build performance issues, changed how this gets done. |
||
staticOptions: { | ||
extensions: ['gz', 'br'], | ||
index: "index.json.gz", | ||
redirect: true, | ||
setHeaders, | ||
}, | ||
publicPath: '/dicomweb', | ||
}, | ||
{ | ||
directory: '../../testdata', | ||
staticOptions: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,5 +34,9 @@ | |
"packageName": "@ohif/mode-longitudinal", | ||
"version": "3.0.0" | ||
} | ||
], | ||
"modesFactory": [ | ||
], | ||
"umd": [ | ||
] | ||
} |
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.
The plugin import piece also returns the "copy" part for the public imports from custom modes/extensions.