ES modules defined with define_module share one registry per browser page, so two kernels in one JupyterLab page can see each other's modules.
Problem
JupyterLab shows notebooks with different kernels in one browser page.
The ES module support in ipyvue (#106, #108) and ipyreact (#83) keeps one module registry and one es-module-shims import map per page, keyed only by the module name.
- Two kernels that define different module names work.
- Two kernels that define the same name with different code overwrite each other. The last load wins for both notebooks, and a hot reload in one notebook changes the other.
- Imports between modules go through the single import map, so they collide in the same way.
- A Vue plugin module from one kernel is installed on every ipyvue app on the page, so in the other notebooks too (Vue 2 already has one global component registry).
- Solara is not affected: each browser page has one kernel.
Mario raised this. We do not know the best solution yet, so we merge the ES module PRs with this limit documented and track it here.
Possible directions
- Key the module registry by widget manager (one per kernel), so a widget only gets modules from its own kernel. This is a moderate change in ipyvue and ipyreact.
- Imports between modules are the hard part: es-module-shims has one import map per page. One option is a kernel-specific name per module (for example a prefix) that is rewritten when the module is imported.
- Decide whether plugins should be installed only on the apps of the kernel that defined them.
Related
🤖 Generated with Claude Code
ES modules defined with
define_moduleshare one registry per browser page, so two kernels in one JupyterLab page can see each other's modules.Problem
JupyterLab shows notebooks with different kernels in one browser page.
The ES module support in ipyvue (#106, #108) and ipyreact (#83) keeps one module registry and one es-module-shims import map per page, keyed only by the module name.
Mario raised this. We do not know the best solution yet, so we merge the ES module PRs with this limit documented and track it here.
Possible directions
Related
🤖 Generated with Claude Code