Looking inside node_modules I see that there’s a single module, my notebook, and inside it is the code for that notebook, containing cells like these for import statements:
{
from: "@yurivish/common",
name: "min",
remote: "min"
}, /* many more of these, including references to private notebooks */
Is there a way to add a notebook to a project bundled together with its transitive dependencies?
Aha, I was using the old format. The other thing is that there’s currently no error if you install a notebook with private dependencies — they just silently won’t get included. I’ve now tested with enabling sharing on one of them and it successfully installs.
Now that I tried running the code, I’m seeing a “modules not iterable” error when I test this out with my notebook. The example notebook from the post works fine.
load.js:20 Uncaught TypeError: modules is not iterable
at Function.load (load.js:20)
at main.js:22
at main.js:31
load @ load.js:20
(anonymous) @ main.js:22
(anonymous) @ main.js:31
Using the Chrome debugger I see that notebook is a function, rather than an object:
One difference is that my notebooks have circular dependencies — I have a “library” notebook that imports functions from other notebooks for re-export, and in a few cases the library notebook imports function A from some notebook which imports function B from the library notebook. Rollup gives me warnings about circular dependencies though I don’t know if it’s a problem, since everything works perfectly on observablehq.com.
Edit: It probably can’t be that, since there are circular dependencies within e. g. the inspector, not just my notebooks:
You appear to be calling Runtime.load, which was deprecated and not needed with the v=3 format. Please see the README for documentation on how to load a module:
Ah, the blog post I was following is just out of date. My apologies.
I now have my notebook running using the instructions in the README, but the majority of the cells report as “could not be resolved”, and it looks like those are some (but not all) of the cells imported from my library notebook.
I’ll see if I can make a reduced problematic case, or report back if I figure out what’s going on.