As you probably know, it is now possible to run Observable code in Quarto (see) and combine it with other languages. This is really great !!!
So I did a few tests (see) and it works perfectly well. However, I can’t import the bertinjs library with the require(“bertin@0.9.15”) instruction, which works perfectly within Observable. The message is OJS Error RequireError$1: invalid module. Actually, only the import(‘https://cdn.skypack.dev/bertin@0.9.15’) instruction works. I created other modules in the same way, but they work. In short, being a beginner in javascript, I have no idea where the problem can come from. Any help is welcome. My github repo is here : GitHub - neocarto/bertin: A package to draw maps in javascript.
See also javascript - Error Quarto require invalid module (bertin.js) - Stack Overflow
There are two instances of d3-require
. When both try to require a package simultaneously, only the last will succeed. You can find more information and a workaround here:
I wrote that notebook because a similar problem occurred in Range Slider / Fabian Iwand / Observable where Inputs / Jeremy Ashkenas / Observable gets imported lazily via a separate Runtime instance.
The name requireCompat
will probably change before I publish the notebook, so be sure to lock the imported version.
@neocarto Is your question specifically about RStudio? Because I don’t see how updating Chrome in a desktop software would fix the OJS error in the web version at Combining R & Observable javascript with Quarto
Yes it’s about Rstudio actually.
See OJS Error. RequireError$1: invalid module. · Issue #943 · quarto-dev/quarto-cli · GitHub
Interestingly, quarto-cli uses a fork of d3-require that attempts to handle multiple conflicting module loaders:
which is based on the branch GitHub - d3/d3-require at mbostock/restore-define