Skip to content

Commit

Permalink
chore: make base path relative
Browse files Browse the repository at this point in the history
Closes Kitware#690

Co-authored-by: amazy <[email protected]>
  • Loading branch information
PaulHax and amazy committed Jan 28, 2025
1 parent 17ea21e commit e3a2145
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/io/itk/itkConfig.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { join } from '@/src/utils/path';
const fullUrl = (relative) => {
// ex: /itk/image-io
const u = new URL(document.location); // ex: http://localhost:8043/orthanc/volview/index.html
const origin = u.origin; // ex: http://localhost:8043
const pathParts = u.pathname.split('/'); // ex: ['', 'orthanc', 'volview', 'index.html']
pathParts.pop(); // ex: ['', 'orthanc', 'volview']

const base = import.meta.env.BASE_URL;

const fullUrl = (relative) =>
new URL(join(base, relative), document.location.origin).href;
const url = origin + pathParts.join('/') + relative; // ex http://localhost:8043/orthanc/volview/itk/image-io
return url;
};

const itkConfig = {
pipelineWorkerUrl: fullUrl('/itk/itk-wasm-pipeline.min.worker.js'),
Expand Down
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function configureSentryPlugin() {
}

export default defineConfig({
base: './',
build: {
outDir: distDir,
rollupOptions: {
Expand Down

0 comments on commit e3a2145

Please sign in to comment.