Skip to content
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

Bundling viewer #4

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Bundling viewer #4

wants to merge 5 commits into from

Conversation

stevejpurves
Copy link
Member

purpose of this PR is to attempt to bundle all itk viewer deps (without the WASM) into a single file (ESM) that can then be dynamically loaded in the NodeRenderer

@stevejpurves
Copy link
Member Author

@PaulHax no success yet but wanted to share the approach I was working on

@stevejpurves
Copy link
Member Author

currrently hitting this

renderer tsx — Untitled (Workspace) 2024-07-12 15-35-30

@PaulHax
Copy link
Contributor

PaulHax commented Jul 13, 2024

Guessing that the build is pulling from this file:
https://github.com/InsightSoftwareConsortium/ITK-Wasm/blob/main/packages/core/typescript/itk-wasm/src/index-node.ts

But we want tsup to get the browser conditional index.js
https://github.com/InsightSoftwareConsortium/ITK-Wasm/blob/main/packages/core/typescript/itk-wasm/package.json#L12-L14

Is it possible to feed that -conditions flag to tsup or the build tool?
https://nodejs.org/api/packages.html#resolving-user-conditions

@thewtex

@thewtex
Copy link

thewtex commented Jul 13, 2024

PR against this branch to address the build here: #5 🎇

thewtex and others added 2 commits July 13, 2024 17:12
This ensures we get the correct package.json `exports` conditions.

Which is passed to esbuild

  https://esbuild.github.io/api/#platform

to get the correct conditions for the `browser`:

  https://nodejs.org/api/packages.html#resolving-user-conditions

The default for tsup is `node`.
Use --platform browser in tsup
@stevejpurves
Copy link
Member Author

@PaulHax @thewtex I think we will be integrating this, which might be a generic vehicle to get any renderer into myst https://github.com/manzt/anymyst

@thewtex
Copy link

thewtex commented Jul 15, 2024

@stevejpurves awesome! We will look into that soon as we explore re-adding ipywidget support to itkwidgets

At the same time, the itk-viewer plugin will also be helpful because it will not require writing or running any code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants