Using external JS Libraries in TW Plugins

Hi @GameDungeon – the preferred approach is indeed to package the library as a JS tiddler that can be accessed with require(). You can see a number of examples of that approach in the plugins folder of the TW5 repo.

The idea is that we always copy the full, versioned source of the library into the TW5 repo (ie we don’t use npm to dynamically pull them down from the internet). To simplify upgrades, we try not to modify the original files. In some cases we use the tiddlywiki.files file to wrap libraries with a custom prefix/suffix to adapt the calling convention.

The other approach is to include the external library as an ordinary script tag in a raw markup tiddler, but nowadays that seems to seldom be necessary.

Do feel free to ask any specific questions – GitHub might be more appropriate for some of these discussions because of the improved support for embedding code within posts.