Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions platform/app/.webpack/webpack.pwa.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// https://developers.google.com/web/tools/workbox/guides/codelabs/webpack
// ~~ WebPack
const path = require('path');
const fs = require('fs');
const { merge } = require('webpack-merge');
const webpack = require('webpack');
const webpackBase = require('./../../../.webpack/webpack.base.js');
Expand Down Expand Up @@ -35,6 +36,13 @@ const open = process.env.OHIF_OPEN !== 'false';

const copyPluginFromExtensions = writePluginImportFile(SRC_DIR, DIST_DIR);

// ONNX Runtime Web dist (WASM + JSEP for WebGPU). Try root then app node_modules.
const onnxDistCandidates = [
path.resolve(__dirname, '../../../node_modules/onnxruntime-web/dist'),
path.resolve(__dirname, '../../node_modules/onnxruntime-web/dist'),
];
const onnxDistFrom = onnxDistCandidates.find((p) => fs.existsSync(p));

const setHeaders = (res, path) => {
if (path.indexOf('.gz') !== -1) {
res.setHeader('Content-Encoding', 'gzip');
Expand Down Expand Up @@ -102,10 +110,10 @@ module.exports = (env, argv) => {
ignore: ['**/config/**', '**/html-templates/**', '.DS_Store'],
},
},
{
from: '../../../node_modules/onnxruntime-web/dist',
to: `${DIST_DIR}/ort`,
},
// Copy ONNX Runtime Web dist to /ort (includes ort-wasm-simd-threaded.jsep.wasm for WebGPU)
...(onnxDistFrom
? [{ from: onnxDistFrom, to: `${DIST_DIR}/ort` }]
: []),
// Short term solution to make sure GCloud config is available in output
// for our docker implementation
{
Expand Down
17 changes: 11 additions & 6 deletions rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,17 @@ export default defineConfig({
copy: [
// Copy plugin files (handled by writePluginImportsFile)
...(writePluginImportsFile(SRC_DIR, DIST_DIR) || []),
// Copy public directory except config and html-templates
{
from: path.resolve(__dirname, 'node_modules/onnxruntime-web/dist'),
to: `${DIST_DIR}/ort`,
force: true,
},
// Copy ONNX Runtime Web dist for SAM segmentation (includes ort-wasm-simd-threaded.jsep.wasm for WebGPU)
...(function () {
const candidates = [
path.resolve(__dirname, 'node_modules/onnxruntime-web/dist'),
path.resolve(__dirname, 'platform/app/node_modules/onnxruntime-web/dist'),
];
const from = candidates.find((p) => fs.existsSync(p));
return from
? [{ from, to: `${DIST_DIR}/ort`, force: true }]
: [];
})(),
{
from: PUBLIC_DIR,
to: DIST_DIR,
Expand Down
2 changes: 1 addition & 1 deletion testdata
Submodule testdata updated 3498 files