Skip to content

Webpack Public Path to import 'itk-vtk-viewer' downstream #485

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ module.exports = function init(config) {
served: true,
included: false,
},
{
pattern: './dist/pipeline.worker.js',
watched: true,
served: true,
included: false,
},
{
pattern: './src/UI/reference-ui/dist/referenceUIMachineOptions.js',
watched: true,
Expand Down
7 changes: 5 additions & 2 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ declare type ndarray = {
_rtype: 'ndarray'
}

declare type LoadableImage = URL | Image | Store | ndarray
declare type LoadableImage = URL | Store | ndarray | Image

declare type ViewerOptions = {
image?: LoadableImage
Expand All @@ -20,7 +20,7 @@ declare type ViewerOptions = {

type Viewer = {
setBackgroundColor(color: [number, number, number]): void
setImageColorMap(mapName: string, actor: number): void
setImageColorMap(mapName: string, actor?: number): void
}

declare namespace itkVtkViewer {
Expand Down Expand Up @@ -51,3 +51,6 @@ declare namespace itkVtkViewer {

type version = string
}

export as namespace itkVtkViewer
export = itkVtkViewer
8 changes: 4 additions & 4 deletions src/itkConfig.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const itkConfig = {
pipelineWorkerUrl: __webpack_public_path__ + 'itk/web-workers/min-bundles/pipeline.worker.js', // eslint-disable-line no-undef
imageIOUrl: __webpack_public_path__ + 'itk/image-io', // eslint-disable-line no-undef
meshIOUrl: __webpack_public_path__ + 'itk/mesh-io', // eslint-disable-line no-undef
pipelinesUrl: __webpack_public_path__ + 'itk/pipeline', // eslint-disable-line no-undef
pipelineWorkerUrl: 'pipeline.worker.js',
imageIOUrl: 'itk/image-io',
meshIOUrl: 'itk/mesh-io',
pipelinesUrl: 'itk/pipeline',
}

export default itkConfig
13 changes: 13 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ module.exports = (env, argv) => [
devtool: argv.mode === 'development' ? 'eval-source-map' : 'source-map',
output: {
filename: 'itkVtkViewer.js',
publicPath: '',
},
resolve: {
alias: {
Expand All @@ -94,6 +95,18 @@ module.exports = (env, argv) => [
),
to: path.join(__dirname, 'dist', 'itk', 'web-workers'),
},
{
from: path.join(
__dirname,
'node_modules',
'itk-wasm',
'dist',
'web-workers',
'min-bundles',
'pipeline.worker.js'
),
to: path.join(__dirname, 'dist', 'pipeline.worker.js'),
},
{
from: path.join(__dirname, 'node_modules', 'itk-image-io'),
to: path.join(__dirname, 'dist', 'itk', 'image-io'),
Expand Down