Problem using `import` with `with`

Hello! I’m trying to reuse an existing visualization (one of @mbostock’s examples) but running into some trouble using the with clause of the import statement. Can anyone see what I’m doing wrong?

Here’s a minimal reproduction: a notebook that attempts to import chart from the notebook, as suggested here, substituting data with ourdata: https://beta.observablehq.com/@yurivish/test/2

Hi - mind giving a bit more detail about what’s going wrong? Loading that notebook works, and it looks like the data is properly replaced.

Are you seeing an error message? Wrong behavior? Something else?

1 Like

…Huh, it works now. It didn’t work before — earlier it was saying the binding to “chart” could not be properly resolved. It does seem to work now – thanks!

We just fixed a bug where import-with wouldn’t work in some cases on a freshly-created notebook.

2 Likes

Thanks! I ran into that one a few times but never reported it.

I’m not sure that’s fully resolved. Namely I

  1. made a new notebook with some markdown
  2. made a new notebook with a chart
  3. import the newly made chart in the first notebook, without any error
  4. tried to use chart imported from the second notebook to display it in the first resulting in an unresolved symbol

After modifying a bit of everything reverting to the initial import {chart} from “@utopiah/my-visualisation” ended up working as expected.