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
and you want to create and componentize a JS module which provides that interface.
The first thing that trips you up is that nothing tells you want module specifier to use for the import. If you pick one at random:
import{foo}from'??';exportfunctionhello(name){return`hello ${name} here is your value: ${foo()}`;}
That produces
Import '??' in source.js is not defined as a world import. Only component-defined imports can be used.
Unable to link the source code. Imports should be:
import { default } from "foo";
which at least suggests that the module specifier should match the import name. (Though it's confusing that it says the error is in source.js given that my file is in fact named hello.js.) Great! Ideally that would be documented outside of the error message.
Unfortunately, the code it suggests is a syntax error (since default is not a valid identifier name in JS). You actually want a default import, as in:
importnameOfYourChoicefrom"foo";exportfunctionhello(name){return`hello ${name} here is your value: ${nameOfYourChoice()}`;}
which does in fact work once you provide the right bindings, for example with JCO:
Suppose you have the following WIT:
and you want to create and componentize a JS module which provides that interface.
The first thing that trips you up is that nothing tells you want module specifier to use for the import. If you pick one at random:
That produces
which at least suggests that the module specifier should match the import name. (Though it's confusing that it says the error is in
source.js
given that my file is in fact namedhello.js
.) Great! Ideally that would be documented outside of the error message.Unfortunately, the code it suggests is a syntax error (since
default
is not a valid identifier name in JS). You actually want a default import, as in:which does in fact work once you provide the right bindings, for example with JCO:
can be run with
The text was updated successfully, but these errors were encountered: