You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will leave the trail of failed attempts below, and issue open, in case there's any documentation etc. that should come from this. Feel free to close though!
I'm happy you were able to figure it out! Starboard needs a documentation site badly, one of the things that should definitely be in there is a guide to importing code. There are quite some configurations:
ESM with default export
ESM with named exports
CommonJS
AMD.js (not common at all anymore thankfully)
No module system: it just puts something on the window object
No module system & auto-executes a bunch of JS (e.g. P5.js)
And for each of these there are either the dynamic import style and ES import style:
// Dynamic importimport"bla.js"importMyLibfrom"bla.js";import*asMyLibfrom"bla.js";import{someFunction}from"bla.js";import{someFunctionasanotherName}from"bla.js";import{defaultasMyLib}from"bla.js";// This one is weird: a named export of `default` is dodgy.// JS style importawaitimport("bla.js");constMyLib=awaitimport("bla.js");const{someFunction}=awaitimport("bla.js");const{default: MyLib}=awaitimport("bla.js");// a bit weird..
And then some packages will import Node-only stuff (like https in the last of your examples), which need to be polyfilled (or excluded).
Here is an idea: there could be an online tool that statically analyzes the code and tells you how to import it and whether it is browser-friendly or not (and whether skypack can make it browser friendly).
semi-related to #94, I've tried to use plotly.js in Starboard in a few ways, but nothing I've tried has worked. Here (and below) are a few things I've tried: https://starboard.gg/runsascoded/plotly-js-test-nDXqtpJ
Is there a way to use plotly.js in Starboard?
Update: I think I found a way! It's in the notebook above now, JS cell:
Screencast
Will leave the trail of failed attempts below, and issue open, in case there's any documentation etc. that should come from this. Feel free to close though!
JS cell
seemingly gives an empty module object
ESM cell
gives error:
Skypack imports
I noticed that the demo imports on the homepage starboard.gg all come from cdn.skypack.dev, so I tried a few of those (in ESM cells):
plotly.js
:errors with:
plotly.js-dist
Similar error:
plotly
Seems to have a different problem:
The text was updated successfully, but these errors were encountered: