Thank you Jeremy and Tony for the replies (and noted on the separate Dev group).
Appreciate the tips, I will work off of the examples. I've been itching to do this sort of thing to extend the use of 'TW on AWS' as a static site generator. Will report back with any worthwhile documentation for other learners. Phil On Saturday, November 2, 2019 at 12:37:42 PM UTC-4, Jeremy Ruston wrote: > > Hi Phil > > As you say, the best solution is to wrap the xmlhttprequest JS file into a > tiddler, and then require that tiddler. > > The basic approach is to use a “tiddlywiki.files” file to turn the raw JS > file into a tiddler. This mechanism includes the possibility of adding a > prefix/suffix to the text of the file: > > https://tiddlywiki.com/#tiddlywiki.files%20Files > > There are a number of examples of third party modules wrapped for > TiddlyWiki in the core repo: > > https://github.com/Jermolene/TiddlyWiki5/tree/master/plugins/tiddlywiki > > In particular, the jszip plugin contains an example of publishing a module > as a tiddler, and the AWS plugin contains an example of using it. > > Best wishes > > Jeremy > > > On 31 Oct 2019, at 17:27, Philip Wonski <[email protected] <javascript:>> > wrote: > > Hi Group- > > 1) I have a TW that does some frontend AJAX using simple XMLHttpRequest in > the browser. > > 2) If I try to render the AJAX tiddler in Lambda, it throws the common > node error since node requires a separate package xmlhttprequest. > > 3) My question is, how best to include this dependency in the Lambda. I > tried first with npm locally, then zipping the updated package.json plus > the node_modules folder with xmlhttprequest module included. > > 3b- this still throws an error as the lambda is not finding the module. > Presumably I am violating "everything is a tiddler" and need my js inside > the index.js. > > 3c- so it seems better approach is to require the module as a tiddler like > var XMLHttpRequest = require("$:/mymodules/xmlhttprequest").XMLHttpRequest > ; > > > But I am new to creating modules in TW, so before I waste hours with trial > and error I figured I'd make sure I'm on the right track. How should my > original xmlhttprequest.js be modified so that it works as a tiddler like > $:/mymodules/xmlhttprequest? > > > Sincere thanks, > > Phil > > > -- > You received this message because you are subscribed to the Google Groups > "TiddlyWiki" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tiddlywiki/47575207-c2b9-4386-b8d5-aafe9ec48faa%40googlegroups.com > > <https://groups.google.com/d/msgid/tiddlywiki/47575207-c2b9-4386-b8d5-aafe9ec48faa%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/5615d00a-f0bc-4a5d-ae84-299db083f7b5%40googlegroups.com.

