observablehq/runtime

can't embed lazy imports

declann opened this issue · 3 comments

Hi,

Getting following error when I try to embed a notebook which includes a lazy import, into a React app.

I believe some part of the runtime is calling lazyImport with no slug. The calls within the notebook code seem to include a slug.

image

from notebook:

image

version: "@observablehq/runtime": "^5.6.1"

I'm embedding https://api.observablehq.com/@declann/calculang-streamlining-interactive-data.tgz?v=3

but the dependency, b2bbebd2f186ed03@1786.js is where I see errors. That dependency tries to lazy import @mootari/signature : something appears to be incompatible or broken.

Happy to provide more details and will dig and debug proper if this is a big surprise!

Regards,
Declan

Apologies, I can see the problematic code is a part of the notebook.
Makes me go 🤯 but this is far more specific to me that I thought!

@declann Something else must be amiss. If you're only importing interval, then there is no reason why that particular piece of code should run. I'm guessing that your bundler (likely webpack?) tries to resolve and bundle that dynamic import because it starts with a static path. I suspect you'll run into that a few more times with other notebooks.

I've removed lazyImport from https://observablehq.com/@mootari/range-slider since Observable now supports lazy imports for notebooks natively.