Feature request: conditional imports

If I might add my two cents: I think the current import with syntax should be deprecated and replaced with an import helper in the stdlib or runtime that works similarly to d3-require (and would likely just end up being a custom resolver?).

Let’s be honest, the current syntax is confusing as hell when you’re not familiar with this Observable feature:

  • syntax mimics static import syntax, but only supports a fraction of the actual syntax
  • allows only notebook imports
  • notebook imports look like npm package identifiers, but are notebooks exclusively hosted on observablehq.com
  • with syntax is completely non-standard (unless I’ve missed something?) and makes the whole thing even weirder

viewof and mutable are less problematic because they don’t redefine existing keywords.

4 Likes