fix: update script-tag output to include config from default.js
instead of hardcoded config
This commit is contained in:
parent
980516fcfc
commit
c522ff3dda
@ -12,7 +12,9 @@ const SRC_DIR = path.join(__dirname, '../src');
|
|||||||
const DIST_DIR = path.join(__dirname, '../dist');
|
const DIST_DIR = path.join(__dirname, '../dist');
|
||||||
const PUBLIC_DIR = path.join(__dirname, '../public');
|
const PUBLIC_DIR = path.join(__dirname, '../public');
|
||||||
// ~~ Env Vars
|
// ~~ Env Vars
|
||||||
|
const APP_CONFIG = process.env.APP_CONFIG || 'config/default.js';
|
||||||
const HTML_TEMPLATE = process.env.HTML_TEMPLATE || 'script-tag.html';
|
const HTML_TEMPLATE = process.env.HTML_TEMPLATE || 'script-tag.html';
|
||||||
|
const PUBLIC_URL = process.env.PUBLIC_URL || '/';
|
||||||
|
|
||||||
module.exports = (env, argv) => {
|
module.exports = (env, argv) => {
|
||||||
const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR });
|
const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR });
|
||||||
@ -33,12 +35,22 @@ module.exports = (env, argv) => {
|
|||||||
plugins: [
|
plugins: [
|
||||||
// Clean output.path
|
// Clean output.path
|
||||||
new CleanWebpackPlugin(),
|
new CleanWebpackPlugin(),
|
||||||
|
new CopyWebpackPlugin([
|
||||||
|
// Copy over and rename our target app config file
|
||||||
|
{
|
||||||
|
from: `${PUBLIC_DIR}/${APP_CONFIG}`,
|
||||||
|
to: `${DIST_DIR}/app-config.js`,
|
||||||
|
},
|
||||||
|
]),
|
||||||
// Generate "index.html" w/ correct includes/imports
|
// Generate "index.html" w/ correct includes/imports
|
||||||
// NOTE: We use this for E2E Tests
|
// NOTE: We use this for E2E Tests
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
inject: false,
|
inject: false,
|
||||||
template: `${PUBLIC_DIR}/html-templates/${HTML_TEMPLATE}`,
|
template: `${PUBLIC_DIR}/html-templates/${HTML_TEMPLATE}`,
|
||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
|
templateParameters: {
|
||||||
|
PUBLIC_URL: PUBLIC_URL,
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
new webpack.optimize.LimitChunkCountPlugin({
|
new webpack.optimize.LimitChunkCountPlugin({
|
||||||
maxChunks: 1,
|
maxChunks: 1,
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="<%= PUBLIC_URL %>app-config.js"></script>
|
||||||
<script src="/index.umd.js" crossorigin></script>
|
<script src="/index.umd.js" crossorigin></script>
|
||||||
<script>
|
<script>
|
||||||
var containerId = 'root';
|
var containerId = 'root';
|
||||||
@ -31,25 +32,7 @@
|
|||||||
console.log('OHIF Viewer rendered/updated');
|
console.log('OHIF Viewer rendered/updated');
|
||||||
};
|
};
|
||||||
window.OHIFViewer.installViewer(
|
window.OHIFViewer.installViewer(
|
||||||
{
|
window.config, // See `/config/default.js`
|
||||||
// routerBasename: '/',
|
|
||||||
servers: {
|
|
||||||
dicomWeb: [
|
|
||||||
{
|
|
||||||
name: 'DCM4CHEE',
|
|
||||||
wadoUriRoot:
|
|
||||||
'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado',
|
|
||||||
qidoRoot:
|
|
||||||
'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
|
|
||||||
wadoRoot:
|
|
||||||
'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
|
|
||||||
qidoSupportsIncludeField: true,
|
|
||||||
imageRendering: 'wadors',
|
|
||||||
thumbnailRendering: 'wadors',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
containerId,
|
containerId,
|
||||||
componentRenderedOrUpdatedCallback
|
componentRenderedOrUpdatedCallback
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user