I’m developing an extension that adds new functionality through toolbar buttons and widgets.
In an earlier release, I made
ipywidgets a dependency because of the widgets. Now, I want to make
ipywidgets an optional dependency, so I removed it from the
When testing the package, I realized that removing
ipywidgets broke it, and upon debugging, I noticed that the error came because the extension could not find the
@jupyter-widgets/base JS package. After some debugging, I noticed that my
package.json has a
jupyterlab section and a
sharedPackages subsection (I created this project from the template).
It seems like since I no longer have
ipywidgets as a dependency,
@jupyter-widgets/base is never installed and the package breaks, because it’s configured to share the
What is the best way to configure my extension so the widgets feature is optional?
For now, I eliminated the
sharedPackages section. This fixed the problem, but I’m unsure if this could create other issues and there’s a better way do achieve this.