Have you given the external library a title?
Not exactly sure what your use case is, but if you look at my tiddly-calc
<https://github.com/mklauber/tiddly-calc> plugin, you can see that at the
start of math.js
<https://github.com/mklauber/tiddly-calc/blob/master/math.js#L2> I tell
tiddlywiki what the title, type, and module-type of this file is. This
lets tiddlywiki add it to the tiddler store
<https://tiddlywiki.com/dev/#Datamodel>where it can then be referenced by
require. You can look at line 15 of calc.js
<https://github.com/mklauber/tiddly-calc/blob/master/calc.js#L15> to see
how I do that.
Matt Lauber
On Tuesday, February 5, 2019 at 11:56:27 PM UTC-5, stefano franchi wrote:
>
> Well, I thought I had finally sorted out how how to structure a demo site
> for developing a new widget plugin on tiddlywiki/node, but I have one more
> problem:
> Making tiddlywiki see the external library I need.
>
> I have a local TW/Node site like this:
>
> TW-Demo
> +------------plugins
> +--------myPlugin
> +------------myPlugin.js
> +
> |
> +-----------files
>
> +------myExtLibrary.js
>
>
>
> How do I refer to myExtLIbrary.js within myPlugin.js? I tried the
> following:
>
> var extLib = require("$:/plugins/myPlugin/files/myExtLibrary.js");
>
> var extLib = require("$:/plugins/myPlugin/myExtLibrary.js");
>
> var extLib = require("$:/myExtLibrary.js");
>
> var extLib = require("$:files/myExtLibrary.js");
>
> (I am clueless, obviously)
>
> Everytime I get a "Cannot find module" error. I would immensely grateful
> to anyone kind enough to explain to me the semantics of the expression in
> the require statement. How is the path computed? Is it relative to the
> tiddliwiki module? That seems to implied by the standard use of a statement
> like:
>
> var Widget = require("$:/core/modules/widgets/widget.js").widget;
>
> But that can't be true, otherwise no local installation would ever use a
> plugin...
> There's gotta be some magic somewhere that escapes me.
>
>
> Cheers,
> Stefano
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/39e7a544-9a88-479c-9ddf-cac1181009a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.